Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Ctors](https://developer.android.com/reference/java/io/IOException#pubctors) \| [Inherited Methods](https://developer.android.com/reference/java/io/IOException#inhmethods)

# IOException


`
public


class
IOException
`


`


`

`


`

`

extends https://developer.android.com/reference/java/lang/Exception


`

`


`

|---|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||||
| ↳ | [java.lang.Throwable](https://developer.android.com/reference/java/lang/Throwable) |||
|   | ↳ | [java.lang.Exception](https://developer.android.com/reference/java/lang/Exception) ||
|   |   | ↳ | java.io.IOException |

Known direct subclasses [Base64DataException](https://developer.android.com/reference/android/util/Base64DataException), [BluetoothSocketException](https://developer.android.com/reference/android/bluetooth/BluetoothSocketException), [CharConversionException](https://developer.android.com/reference/java/io/CharConversionException), [CharacterCodingException](https://developer.android.com/reference/java/nio/charset/CharacterCodingException), [ClosedChannelException](https://developer.android.com/reference/java/nio/channels/ClosedChannelException), [EOFException](https://developer.android.com/reference/java/io/EOFException), [FileLockInterruptionException](https://developer.android.com/reference/java/nio/channels/FileLockInterruptionException), [FileNotFoundException](https://developer.android.com/reference/java/io/FileNotFoundException), [FileSystemException](https://developer.android.com/reference/java/nio/file/FileSystemException), [HttpException](https://developer.android.com/reference/android/net/http/HttpException), [HttpRetryException](https://developer.android.com/reference/java/net/HttpRetryException), [IkeTimeoutException](https://developer.android.com/reference/android/net/ipsec/ike/exceptions/IkeTimeoutException), [ImageDecoder.DecodeException](https://developer.android.com/reference/android/graphics/ImageDecoder.DecodeException), [InterruptedByTimeoutException](https://developer.android.com/reference/java/nio/channels/InterruptedByTimeoutException), [InterruptedIOException](https://developer.android.com/reference/java/io/InterruptedIOException), and 19 others. [Base64DataException](https://developer.android.com/reference/android/util/Base64DataException) This exception is thrown by `https://developer.android.com/reference/android/util/Base64InputStream` or `https://developer.android.com/reference/android/util/Base64OutputStream` when an error is detected in the data being decoded. [BluetoothSocketException](https://developer.android.com/reference/android/bluetooth/BluetoothSocketException) Thrown when an error occurs during a Bluetooth Socket related exception. [CharConversionException](https://developer.android.com/reference/java/io/CharConversionException) Base class for character conversion exceptions. [CharacterCodingException](https://developer.android.com/reference/java/nio/charset/CharacterCodingException) Checked exception thrown when a character encoding or decoding error occurs. [ClosedChannelException](https://developer.android.com/reference/java/nio/channels/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](https://developer.android.com/reference/java/io/EOFException) Signals that an end of file or end of stream has been reached unexpectedly during input. [FileLockInterruptionException](https://developer.android.com/reference/java/nio/channels/FileLockInterruptionException) Checked exception received by a thread when another thread interrupts it while it is waiting to acquire a file lock. [FileNotFoundException](https://developer.android.com/reference/java/io/FileNotFoundException) Signals that an attempt to open the file denoted by a specified pathname has failed. [FileSystemException](https://developer.android.com/reference/java/nio/file/FileSystemException) Thrown when a file system operation fails on one or two files. [HttpException](https://developer.android.com/reference/android/net/http/HttpException) Base exception passed to `https://developer.android.com/reference/android/net/http/UrlRequest.Callback#onFailed(android.net.http.UrlRequest,%20android.net.http.UrlResponseInfo,%20android.net.http.HttpException)`. [HttpRetryException](https://developer.android.com/reference/java/net/HttpRetryException) Thrown to indicate that a HTTP request needs to be retried but cannot be retried automatically, due to streaming mode being enabled. [IkeTimeoutException](https://developer.android.com/reference/android/net/ipsec/ike/exceptions/IkeTimeoutException) This exception is thrown when there is an IKE retransmission timeout. [ImageDecoder.DecodeException](https://developer.android.com/reference/android/graphics/ImageDecoder.DecodeException) Information about an interrupted decode. [InterruptedByTimeoutException](https://developer.android.com/reference/java/nio/channels/InterruptedByTimeoutException) Checked exception received by a thread when a timeout elapses before an asynchronous operation completes. [InterruptedIOException](https://developer.android.com/reference/java/io/InterruptedIOException) Signals that an I/O operation has been interrupted. [InvalidPropertiesFormatException](https://developer.android.com/reference/java/util/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 `https://developer.android.com/reference/java/util/Properties` specification. [MalformedJsonException](https://developer.android.com/reference/android/util/MalformedJsonException) Thrown when a reader encounters malformed JSON. [MalformedURLException](https://developer.android.com/reference/java/net/MalformedURLException) Thrown to indicate that a malformed URL has occurred. [MediaParser.ParsingException](https://developer.android.com/reference/android/media/MediaParser.ParsingException) Thrown when an error occurs while parsing a media stream. [MediaParser.UnrecognizedInputFormatException](https://developer.android.com/reference/android/media/MediaParser.UnrecognizedInputFormatException) Thrown if all parser implementations provided to `https://developer.android.com/reference/android/media/MediaParser#create(android.media.MediaParser.OutputConsumer,%20java.lang.String[])` failed to sniff the input content. [ObjectStreamException](https://developer.android.com/reference/java/io/ObjectStreamException) Superclass of all exceptions specific to Object Stream classes. [ParcelFileDescriptor.FileDescriptorDetachedException](https://developer.android.com/reference/android/os/ParcelFileDescriptor.FileDescriptorDetachedException) Exception that indicates that the file descriptor was detached. [ProtocolException](https://developer.android.com/reference/java/net/ProtocolException) Thrown to indicate that there is an error in the underlying protocol, such as a TCP error. [SSLException](https://developer.android.com/reference/javax/net/ssl/SSLException) Indicates some kind of error detected by an SSL subsystem. [SocketException](https://developer.android.com/reference/java/net/SocketException) Thrown to indicate that there is an error creating or accessing a Socket. [SyncFailedException](https://developer.android.com/reference/java/io/SyncFailedException) Signals that a sync operation has failed. [TagLostException](https://developer.android.com/reference/android/nfc/TagLostException) [UTFDataFormatException](https://developer.android.com/reference/java/io/UTFDataFormatException) Signals that a malformed string in [modified UTF-8](https://developer.android.com/reference/java/io/DataInput#modified-utf-8) format has been read in a data input stream or by any class that implements the data input interface. [UnknownHostException](https://developer.android.com/reference/java/net/UnknownHostException) Thrown to indicate that the IP address of a host could not be determined. [UnknownServiceException](https://developer.android.com/reference/java/net/UnknownServiceException) Thrown to indicate that an unknown service exception has occurred. [UnsupportedEncodingException](https://developer.android.com/reference/java/io/UnsupportedEncodingException) The Character Encoding is not supported. [UserPrincipalNotFoundException](https://developer.android.com/reference/java/nio/file/attribute/UserPrincipalNotFoundException) Checked exception thrown when a lookup of `https://developer.android.com/reference/java/nio/file/attribute/UserPrincipal` fails because the principal does not exist. [VibrationEffect.VibrationParseException](https://developer.android.com/reference/android/os/VibrationEffect.VibrationParseException) Exception thrown when parsing a vibration XML fails due to invalid format or values. [ZipException](https://developer.android.com/reference/java/util/zip/ZipException) Signals that a Zip exception of some sort has occurred. Known indirect subclasses [AccessDeniedException](https://developer.android.com/reference/java/nio/file/AccessDeniedException), [AsynchronousCloseException](https://developer.android.com/reference/java/nio/channels/AsynchronousCloseException), [AtomicMoveNotSupportedException](https://developer.android.com/reference/java/nio/file/AtomicMoveNotSupportedException), [BindException](https://developer.android.com/reference/java/net/BindException), [CallbackException](https://developer.android.com/reference/android/net/http/CallbackException), [ClosedByInterruptException](https://developer.android.com/reference/java/nio/channels/ClosedByInterruptException), [ConnectException](https://developer.android.com/reference/java/net/ConnectException), [ConnectTimeoutException](https://developer.android.com/reference/org/apache/http/conn/ConnectTimeoutException), [DirectoryNotEmptyException](https://developer.android.com/reference/java/nio/file/DirectoryNotEmptyException), [EchConfigMismatchException](https://developer.android.com/reference/android/net/ssl/EchConfigMismatchException), [FileAlreadyExistsException](https://developer.android.com/reference/java/nio/file/FileAlreadyExistsException), [FileSystemLoopException](https://developer.android.com/reference/java/nio/file/FileSystemLoopException), [InvalidClassException](https://developer.android.com/reference/java/io/InvalidClassException), [InvalidEchDataException](https://developer.android.com/reference/android/net/ssl/InvalidEchDataException), [InvalidObjectException](https://developer.android.com/reference/java/io/InvalidObjectException), and 20 others. [AccessDeniedException](https://developer.android.com/reference/java/nio/file/AccessDeniedException) Checked exception thrown when a file system operation is denied, typically due to a file permission or other access check. [AsynchronousCloseException](https://developer.android.com/reference/java/nio/channels/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](https://developer.android.com/reference/java/nio/file/AtomicMoveNotSupportedException) Checked exception thrown when a file cannot be moved as an atomic file system operation. [BindException](https://developer.android.com/reference/java/net/BindException) Signals that an error occurred while attempting to bind a socket to a local address and port. [CallbackException](https://developer.android.com/reference/android/net/http/CallbackException) Exception passed to `https://developer.android.com/reference/android/net/http/UrlRequest.Callback#onFailed(android.net.http.UrlRequest,%20android.net.http.UrlResponseInfo,%20android.net.http.HttpException)` when `https://developer.android.com/reference/android/net/http/UrlRequest.Callback` or `https://developer.android.com/reference/android/net/http/UploadDataProvider` method throws an exception. [ClosedByInterruptException](https://developer.android.com/reference/java/nio/channels/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](https://developer.android.com/reference/java/net/ConnectException) Signals that an error occurred while attempting to connect a socket to a remote address and port. [ConnectTimeoutException](https://developer.android.com/reference/org/apache/http/conn/ConnectTimeoutException) *This class was deprecated
in API level 22.
Please use `https://developer.android.com/reference/java/net/URL#openConnection()` instead.
Please visit [this webpage](http://android-developers.blogspot.com/2011/09/androids-http-clients.html)
for further details.* [DirectoryNotEmptyException](https://developer.android.com/reference/java/nio/file/DirectoryNotEmptyException) Checked exception thrown when a file system operation fails because a directory is not empty. [EchConfigMismatchException](https://developer.android.com/reference/android/net/ssl/EchConfigMismatchException) Exception thrown when the provided ECH (Encrypted Client Hello) config does not match the server. [FileAlreadyExistsException](https://developer.android.com/reference/java/nio/file/FileAlreadyExistsException) Checked exception thrown when an attempt is made to create a file or directory and a file of that name already exists. [FileSystemLoopException](https://developer.android.com/reference/java/nio/file/FileSystemLoopException) Checked exception thrown when a file system loop, or cycle, is encountered. [InvalidClassException](https://developer.android.com/reference/java/io/InvalidClassException) Thrown when the Serialization runtime detects one of the following problems with a Class. [InvalidEchDataException](https://developer.android.com/reference/android/net/ssl/InvalidEchDataException) Exception thrown when the ECH (Encrypted Client Hello) data is empty or invalid. [InvalidObjectException](https://developer.android.com/reference/java/io/InvalidObjectException) Indicates that one or more deserialized objects failed validation tests. [JarException](https://developer.android.com/reference/java/util/jar/JarException) Signals that an error of some sort has occurred while reading from or writing to a JAR file. [MalformedInputException](https://developer.android.com/reference/java/nio/charset/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](https://developer.android.com/reference/android/net/http/NetworkException) Exception passed to `https://developer.android.com/reference/android/net/http/UrlRequest.Callback#onFailed(android.net.http.UrlRequest,%20android.net.http.UrlResponseInfo,%20android.net.http.HttpException)` when the HTTP stack fails to process a network request. [NoRouteToHostException](https://developer.android.com/reference/java/net/NoRouteToHostException) Signals that an error occurred while attempting to connect a socket to a remote address and port. [NoSuchFileException](https://developer.android.com/reference/java/nio/file/NoSuchFileException) Checked exception thrown when an attempt is made to access a file that does not exist. [NotActiveException](https://developer.android.com/reference/java/io/NotActiveException) Thrown when serialization or deserialization is not active. [NotDirectoryException](https://developer.android.com/reference/java/nio/file/NotDirectoryException) Checked exception thrown when a file system operation, intended for a directory, fails because the file is not a directory. [NotLinkException](https://developer.android.com/reference/java/nio/file/NotLinkException) Checked exception thrown when a file system operation fails because a file is not a symbolic link. [NotSerializableException](https://developer.android.com/reference/java/io/NotSerializableException) Thrown when an instance is required to have a Serializable interface. [OptionalDataException](https://developer.android.com/reference/java/io/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](https://developer.android.com/reference/java/net/PortUnreachableException) Signals that an ICMP Port Unreachable message has been received on a connected datagram. [QuicException](https://developer.android.com/reference/android/net/http/QuicException) Subclass of `https://developer.android.com/reference/android/net/http/NetworkException` which contains a detailed [QUIC](https://www.chromium.org/quic) error code from [QuicErrorCode](https://cs.chromium.org/search/?q=symbol:%5CbQuicErrorCode%5Cb). [SSLHandshakeException](https://developer.android.com/reference/javax/net/ssl/SSLHandshakeException) Indicates that the client and server could not negotiate the desired level of security. [SSLKeyException](https://developer.android.com/reference/javax/net/ssl/SSLKeyException) Reports a bad SSL key. [SSLPeerUnverifiedException](https://developer.android.com/reference/javax/net/ssl/SSLPeerUnverifiedException) Indicates that the peer's identity has not been verified. [SSLProtocolException](https://developer.android.com/reference/javax/net/ssl/SSLProtocolException) Reports an error in the operation of the SSL protocol. [SocketTimeoutException](https://developer.android.com/reference/java/net/SocketTimeoutException) Signals that a timeout has occurred on a socket read or accept. [StreamCorruptedException](https://developer.android.com/reference/java/io/StreamCorruptedException) Thrown when control information that was read from an object stream violates internal consistency checks. [UnmappableCharacterException](https://developer.android.com/reference/java/nio/charset/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](https://developer.android.com/reference/java/io/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.
**See also:**

- `https://developer.android.com/reference/java/io/InputStream`
- `https://developer.android.com/reference/java/io/OutputStream`

## Summary

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/java/io/IOException#IOException()() ` Constructs an `IOException` with `null` as its error detail message. |
| ` https://developer.android.com/reference/java/io/IOException#IOException(java.lang.String)(https://developer.android.com/reference/java/lang/String message) ` Constructs an `IOException` with the specified detail message. |
| ` https://developer.android.com/reference/java/io/IOException#IOException(java.lang.String,%20java.lang.Throwable)(https://developer.android.com/reference/java/lang/String message, https://developer.android.com/reference/java/lang/Throwable cause) ` Constructs an `IOException` with the specified detail message and cause. |
| ` https://developer.android.com/reference/java/io/IOException#IOException(java.lang.Throwable)(https://developer.android.com/reference/java/lang/Throwable cause) ` 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`). |

### Inherited methods

From class `

https://developer.android.com/reference/java/lang/Throwable

` `


final

void` `
https://developer.android.com/reference/java/lang/Throwable#addSuppressed(java.lang.Throwable)(https://developer.android.com/reference/java/lang/Throwable exception)
`

Appends the specified exception to the exceptions that were
suppressed in order to deliver this exception.


`


https://developer.android.com/reference/java/lang/Throwable` `
https://developer.android.com/reference/java/lang/Throwable#fillInStackTrace()()
`

Fills in the execution stack trace.


`


https://developer.android.com/reference/java/lang/Throwable` `
https://developer.android.com/reference/java/lang/Throwable#getCause()()
`

Returns the cause of this throwable or `null` if the
cause is nonexistent or unknown.


`


https://developer.android.com/reference/java/lang/String` `
https://developer.android.com/reference/java/lang/Throwable#getLocalizedMessage()()
`

Creates a localized description of this throwable.


`


https://developer.android.com/reference/java/lang/String` `
https://developer.android.com/reference/java/lang/Throwable#getMessage()()
`

Returns the detail message string of this throwable.


`


https://developer.android.com/reference/java/lang/StackTraceElement` `
https://developer.android.com/reference/java/lang/Throwable#getStackTrace()()
`

Provides programmatic access to the stack trace information printed by
`https://developer.android.com/reference/java/lang/Throwable#printStackTrace()`.


`


final

https://developer.android.com/reference/java/lang/Throwable` `
https://developer.android.com/reference/java/lang/Throwable#getSuppressed()()
`

Returns an array containing all of the exceptions that were
suppressed, typically by the `try`-with-resources
statement, in order to deliver this exception.


`


https://developer.android.com/reference/java/lang/Throwable` `
https://developer.android.com/reference/java/lang/Throwable#initCause(java.lang.Throwable)(https://developer.android.com/reference/java/lang/Throwable cause)
`

Initializes the *cause* of this throwable to the specified value.


`


void` `
https://developer.android.com/reference/java/lang/Throwable#printStackTrace()()
`

Prints this throwable and its backtrace to the
standard error stream.


`


void` `
https://developer.android.com/reference/java/lang/Throwable#printStackTrace(java.io.PrintWriter)(https://developer.android.com/reference/java/io/PrintWriter s)
`

Prints this throwable and its backtrace to the specified
print writer.


`


void` `
https://developer.android.com/reference/java/lang/Throwable#printStackTrace(java.io.PrintStream)(https://developer.android.com/reference/java/io/PrintStream s)
`

Prints this throwable and its backtrace to the specified print stream.


`


void` `
https://developer.android.com/reference/java/lang/Throwable#setStackTrace(java.lang.StackTraceElement[])(https://developer.android.com/reference/java/lang/StackTraceElement stackTrace)
`

Sets the stack trace elements that will be returned by
`https://developer.android.com/reference/java/lang/Throwable#getStackTrace()` and printed by `https://developer.android.com/reference/java/lang/Throwable#printStackTrace()`
and related methods.


`


https://developer.android.com/reference/java/lang/String` `
https://developer.android.com/reference/java/lang/Throwable#toString()()
`

Returns a short description of this throwable.


From class `

https://developer.android.com/reference/java/lang/Object

` `


https://developer.android.com/reference/java/lang/Object` `
https://developer.android.com/reference/java/lang/Object#clone()()
`

Creates and returns a copy of this object.


`


boolean` `
https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj)
`

Indicates whether some other object is "equal to" this one.


`


void` `
https://developer.android.com/reference/java/lang/Object#finalize()()
`

Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.


`


final

https://developer.android.com/reference/java/lang/Class<?>` `
https://developer.android.com/reference/java/lang/Object#getClass()()
`

Returns the runtime class of this `Object`.


`


int` `
https://developer.android.com/reference/java/lang/Object#hashCode()()
`

Returns a hash code value for the object.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#notify()()
`

Wakes up a single thread that is waiting on this object's
monitor.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#notifyAll()()
`

Wakes up all threads that are waiting on this object's monitor.


`


https://developer.android.com/reference/java/lang/String` `
https://developer.android.com/reference/java/lang/Object#toString()()
`

Returns a string representation of the object.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos)
`

Causes the current thread to wait until it is awakened, typically
by being *notified* or *interrupted*, or until a
certain amount of real time has elapsed.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis)
`

Causes the current thread to wait until it is awakened, typically
by being *notified* or *interrupted*, or until a
certain amount of real time has elapsed.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#wait()()
`

Causes the current thread to wait until it is awakened, typically
by being *notified* or *interrupted*.


## Public constructors

### IOException

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public IOException ()
```

Constructs an `IOException` with `null`
as its error detail message.

<br />

### IOException

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public IOException (String message)
```

Constructs an `IOException` with the specified detail message.

<br />

| Parameters ||
|---|---|
| `message` | `String`: The detail message (which is saved for later retrieval by the `https://developer.android.com/reference/java/lang/Throwable#getMessage()` method) <br /> |

### IOException

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public IOException (String message, 
                Throwable cause)
```

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.

<br />

| Parameters ||
|---|---|
| `message` | `String`: The detail message (which is saved for later retrieval by the `https://developer.android.com/reference/java/lang/Throwable#getMessage()` method) <br /> |
| `cause` | `Throwable`: The cause (which is saved for later retrieval by the `https://developer.android.com/reference/java/lang/Throwable#getCause()` method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.) <br /> |

### IOException

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public IOException (Throwable cause)
```

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.

<br />

| Parameters ||
|---|---|
| `cause` | `Throwable`: The cause (which is saved for later retrieval by the `https://developer.android.com/reference/java/lang/Throwable#getCause()` method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.) <br /> |