IOException  |  API reference  |  Android Developers (original) (raw)

open class IOException : Exception

kotlin.Any
kotlin.Throwable
java.lang.Exception

Known Direct Subclasses

Base64DataException, BluetoothSocketException, CharConversionException, CharacterCodingException, ClosedChannelException, EOFException, FileLockInterruptionException, FileNotFoundException, FileSystemException, HttpException, HttpRetryException, IkeTimeoutException, and 21 others.

Base64DataException This exception is thrown by Base64InputStream or Base64OutputStream when an error is detected in the data being decoded.
BluetoothSocketException Thrown when an error occurs during a Bluetooth Socket related exception.
CharConversionException Base class for character conversion exceptions.
CharacterCodingException Checked exception thrown when a character encoding or decoding error occurs.
ClosedChannelException Checked exception thrown when an attempt is made to invoke or complete an I/O operation upon channel that is closed, or at least closed to that operation.
EOFException Signals that an end of file or end of stream has been reached unexpectedly during input.
FileLockInterruptionException Checked exception received by a thread when another thread interrupts it while it is waiting to acquire a file lock.
FileNotFoundException Signals that an attempt to open the file denoted by a specified pathname has failed.
FileSystemException Thrown when a file system operation fails on one or two files.
HttpException Base exception passed to UrlRequest.Callback.onFailed().
HttpRetryException Thrown to indicate that a HTTP request needs to be retried but cannot be retried automatically, due to streaming mode being enabled.
IkeTimeoutException This exception is thrown when there is an IKE retransmission timeout.
ImageDecoder.DecodeException Information about an interrupted decode.
InterruptedByTimeoutException Checked exception received by a thread when a timeout elapses before an asynchronous operation completes.
InterruptedIOException Signals that an I/O operation has been interrupted.
InvalidPropertiesFormatException Thrown to indicate that an operation could not complete because the input did not conform to the appropriate XML document type for a collection of properties, as per the Properties specification.
MalformedJsonException Thrown when a reader encounters malformed JSON.
MalformedURLException Thrown to indicate that a malformed URL has occurred.
MediaParser.ParsingException Thrown when an error occurs while parsing a media stream.
MediaParser.UnrecognizedInputFormatException Thrown if all parser implementations provided to create failed to sniff the input content.
ObjectStreamException Superclass of all exceptions specific to Object Stream classes.
ParcelFileDescriptor.FileDescriptorDetachedException Exception that indicates that the file descriptor was detached.
ProtocolException Thrown to indicate that there is an error in the underlying protocol, such as a TCP error.
SSLException Indicates some kind of error detected by an SSL subsystem.
SocketException Thrown to indicate that there is an error creating or accessing a Socket.
SyncFailedException Signals that a sync operation has failed.
TagLostException
UTFDataFormatException Signals that a malformed string in modified UTF-8 format has been read in a data input stream or by any class that implements the data input interface.
UnknownHostException Thrown to indicate that the IP address of a host could not be determined.
UnknownServiceException Thrown to indicate that an unknown service exception has occurred.
UnsupportedEncodingException The Character Encoding is not supported.
UserPrincipalNotFoundException Checked exception thrown when a lookup of UserPrincipal fails because the principal does not exist.
ZipException Signals that a Zip exception of some sort has occurred.

Known Indirect Subclasses

AccessDeniedException, AsynchronousCloseException, AtomicMoveNotSupportedException, BindException, CallbackException, ClosedByInterruptException, ConnectException, ConnectTimeoutException, DirectoryNotEmptyException, FileAlreadyExistsException, FileSystemLoopException, InvalidClassException, and 21 others.

AccessDeniedException Checked exception thrown when a file system operation is denied, typically due to a file permission or other access check.
AsynchronousCloseException Checked exception received by a thread when another thread closes the channel or the part of the channel upon which it is blocked in an I/O operation.
AtomicMoveNotSupportedException Checked exception thrown when a file cannot be moved as an atomic file system operation.
BindException Signals that an error occurred while attempting to bind a socket to a local address and port.
CallbackException Exception passed to UrlRequest.Callback.onFailed() when UrlRequest.Callback or UploadDataProvider method throws an exception.
ClosedByInterruptException Checked exception received by a thread when another thread interrupts it while it is blocked in an I/O operation upon a channel.
ConnectException Signals that an error occurred while attempting to connect a socket to a remote address and port.
ConnectTimeoutException A timeout while connecting to an HTTP server or waiting for an available connection from an HttpConnectionManager.
DirectoryNotEmptyException Checked exception thrown when a file system operation fails because a directory is not empty.
FileAlreadyExistsException Checked exception thrown when an attempt is made to create a file or directory and a file of that name already exists.
FileSystemLoopException Checked exception thrown when a file system loop, or cycle, is encountered.
InvalidClassException Thrown when the Serialization runtime detects one of the following problems with a Class.
InvalidObjectException Indicates that one or more deserialized objects failed validation tests.
JarException Signals that an error of some sort has occurred while reading from or writing to a JAR file.
MalformedInputException Checked exception thrown when an input byte sequence is not legal for given charset, or an input character sequence is not a legal sixteen-bit Unicode sequence.
NetworkException Exception passed to UrlRequest.Callback.onFailed() when the HTTP stack fails to process a network request.
NoRouteToHostException Signals that an error occurred while attempting to connect a socket to a remote address and port.
NoSuchFileException Checked exception thrown when an attempt is made to access a file that does not exist.
NotActiveException Thrown when serialization or deserialization is not active.
NotDirectoryException Checked exception thrown when a file system operation, intended for a directory, fails because the file is not a directory.
NotLinkException Checked exception thrown when a file system operation fails because a file is not a symbolic link.
NotSerializableException Thrown when an instance is required to have a Serializable interface.
OptionalDataException Exception indicating the failure of an object read operation due to unread primitive data, or the end of data belonging to a serialized object in the stream.
PortUnreachableException Signals that an ICMP Port Unreachable message has been received on a connected datagram.
QuicException Subclass of NetworkException which contains a detailed QUIC error code from QuicErrorCode.
SSLHandshakeException Indicates that the client and server could not negotiate the desired level of security.
SSLKeyException Reports a bad SSL key.
SSLPeerUnverifiedException Indicates that the peer's identity has not been verified.
SSLProtocolException Reports an error in the operation of the SSL protocol.
SocketTimeoutException Signals that a timeout has occurred on a socket read or accept.
StreamCorruptedException Thrown when control information that was read from an object stream violates internal consistency checks.
UnmappableCharacterException Checked exception thrown when an input character (or byte) sequence is valid but cannot be mapped to an output byte (or character) sequence.
WriteAbortedException Signals that one of the ObjectStreamExceptions was thrown during a write operation.

Signals that an I/O exception of some sort has occurred. This class is the general class of exceptions produced by failed or interrupted I/O operations.

Summary

Public constructors
IOException() Constructs an IOException with null as its error detail message.
IOException(message: String!) Constructs an IOException with the specified detail message.
IOException(message: String!, cause: Throwable!) Constructs an IOException with the specified detail message and cause.
IOException(cause: Throwable!) Constructs an IOException with the specified cause and a detail message of (cause==null ? null : cause.toString()) (which typically contains the class and detail message of cause).

Public constructors

IOException

IOException()

Constructs an IOException with null as its error detail message.

IOException

IOException(message: String!)

Constructs an IOException with the specified detail message.

Parameters
message String!: The detail message (which is saved for later retrieval by the getMessage() method)

IOException

IOException(
    message: String!,
    cause: Throwable!)

Constructs an IOException with the specified detail message and cause.

Note that the detail message associated with cause is not automatically incorporated into this exception's detail message.

Parameters
message String!: The detail message (which is saved for later retrieval by the getMessage() method)
cause Throwable!: The cause (which is saved for later retrieval by the getCause() method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)

IOException

IOException(cause: Throwable!)

Constructs an IOException with the specified cause and a detail message of (cause==null ? null : cause.toString()) (which typically contains the class and detail message of cause). This constructor is useful for IO exceptions that are little more than wrappers for other throwables.

Parameters
cause Throwable!: The cause (which is saved for later retrieval by the getCause() method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)

Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Last updated 2025-02-10 UTC.