Package libcore.io
Class ErrnoException
java.lang.Object
java.lang.Throwable
java.lang.Exception
libcore.io.ErrnoException
- All Implemented Interfaces:
Serializable
public final class ErrnoException extends Exception
A checked exception thrown when
Os methods fail. This exception contains the native
errno value, for comparison against the constants in OsConstants, should sophisticated
callers need to adjust their behavior based on the exact failure.- See Also:
- Serialized Form
-
Field Summary
Fields Modifier and Type Field Description interrno -
Constructor Summary
Constructors Constructor Description ErrnoException(String functionName, int errno)ErrnoException(String functionName, int errno, Throwable cause) -
Method Summary
Modifier and Type Method Description StringgetMessage()Converts the stashed function name and errno value to a human-readable string.IOExceptionrethrowAsIOException()SocketExceptionrethrowAsSocketException()Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Field Details
-
errno
public final int errno
-
-
Constructor Details
-
ErrnoException
-
ErrnoException
-
-
Method Details
-
getMessage
Converts the stashed function name and errno value to a human-readable string. We do this here rather than in the constructor so that callers only pay for this if they need it.- Overrides:
getMessagein classThrowable
-
rethrowAsIOException
- Throws:
IOException
-
rethrowAsSocketException
- Throws:
SocketException
-