Package android.system
Class ErrnoException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- android.system.ErrnoException
-
- All Implemented Interfaces:
Serializable
public final class ErrnoException extends Exception
A checked exception thrown whenOsmethods fail. This exception contains the native errno value, for comparison against the constants inOsConstants, 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 interrnoThe errno value, for comparison with theEconstants inOsConstants.
-
Constructor Summary
Constructors Constructor Description ErrnoException(String functionName, int errno)Constructs an instance with the given function name and errno value.ErrnoException(String functionName, int errno, Throwable cause)Constructs an instance with the given function name, errno value, and cause.
-
Method Summary
All Methods Instance Methods Concrete Methods 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 Detail
-
errno
public final int errno
The errno value, for comparison with theEconstants inOsConstants.
-
-
Constructor Detail
-
ErrnoException
public ErrnoException(String functionName, int errno)
Constructs an instance with the given function name and errno value.
-
-
Method Detail
-
getMessage
public String 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
public IOException rethrowAsIOException() throws IOException
- Throws:
IOException
-
rethrowAsSocketException
public SocketException rethrowAsSocketException() throws SocketException
- Throws:
SocketException
-
-