# ChannelIOException

public class **ChannelIOException** extends [IOException](https://developer.android.com/reference/java/io/IOException.html)  
A subclass of `https://developer.android.com/reference/java/io/IOException.html` which can
be thrown from the streams returned by `https://developers.google.com/android/reference/com/google/android/gms/wearable/Channel#getInputStream(com.google.android.gms.common.api.GoogleApiClient)` and `https://developers.google.com/android/reference/com/google/android/gms/wearable/Channel#getOutputStream(com.google.android.gms.common.api.GoogleApiClient)`.

### Public Constructor Summary

|---|---|
|   | [ChannelIOException](https://developers.google.com/android/reference/com/google/android/gms/wearable/ChannelIOException#ChannelIOException(java.lang.String,%20int,%20int))([String](https://developer.android.com/reference/java/lang/String.html) message, int closeReason, int appSpecificErrorCode) |

### Public Method Summary

|---|---|
| int | [getAppSpecificErrorCode](https://developers.google.com/android/reference/com/google/android/gms/wearable/ChannelIOException#getAppSpecificErrorCode())() Returns the app-specific error code passed to `https://developers.google.com/android/reference/com/google/android/gms/wearable/Channel#close(com.google.android.gms.common.api.GoogleApiClient,%20int)` if that's the reason for the stream closing, or `0` otherwise. |
| int | [getCloseReason](https://developers.google.com/android/reference/com/google/android/gms/wearable/ChannelIOException#getCloseReason())() Returns one of `https://developers.google.com/android/reference/com/google/android/gms/wearable/ChannelApi.ChannelListener#CLOSE_REASON_NORMAL`, `https://developers.google.com/android/reference/com/google/android/gms/wearable/ChannelApi.ChannelListener#CLOSE_REASON_DISCONNECTED`, `https://developers.google.com/android/reference/com/google/android/gms/wearable/ChannelApi.ChannelListener#CLOSE_REASON_REMOTE_CLOSE`, or `https://developers.google.com/android/reference/com/google/android/gms/wearable/ChannelApi.ChannelListener#CLOSE_REASON_LOCAL_CLOSE`, to indicate the reason for the stream closing. |

### Inherited Method Summary

From class java.lang.Throwable

|---|---|
| synchronized final void | addSuppressed([Throwable](https://developer.android.com/reference/java/lang/Throwable.html) arg0) |
| synchronized [Throwable](https://developer.android.com/reference/java/lang/Throwable.html) | fillInStackTrace() |
| synchronized [Throwable](https://developer.android.com/reference/java/lang/Throwable.html) | getCause() |
| [String](https://developer.android.com/reference/java/lang/String.html) | getLocalizedMessage() |
| [String](https://developer.android.com/reference/java/lang/String.html) | getMessage() |
| [StackTraceElement\[\]](https://developer.android.com/reference/java/lang/StackTraceElement.html) | getStackTrace() |
| synchronized final [Throwable\[\]](https://developer.android.com/reference/java/lang/Throwable.html) | getSuppressed() |
| synchronized [Throwable](https://developer.android.com/reference/java/lang/Throwable.html) | initCause([Throwable](https://developer.android.com/reference/java/lang/Throwable.html) arg0) |
| void | printStackTrace() |
| void | printStackTrace([PrintWriter](https://developer.android.com/reference/java/io/PrintWriter.html) arg0) |
| void | printStackTrace([PrintStream](https://developer.android.com/reference/java/io/PrintStream.html) arg0) |
| void | setStackTrace([StackTraceElement\[\]](https://developer.android.com/reference/java/lang/StackTraceElement.html) arg0) |
| [String](https://developer.android.com/reference/java/lang/String.html) | toString() |

From class java.lang.Object

|---|---|
| [Object](https://developer.android.com/reference/java/lang/Object.html) | clone() |
| boolean | equals([Object](https://developer.android.com/reference/java/lang/Object.html) arg0) |
| void | finalize() |
| final [Class](https://developer.android.com/reference/java/lang/Class.html)\<?\> | getClass() |
| int | hashCode() |
| final void | notify() |
| final void | notifyAll() |
| [String](https://developer.android.com/reference/java/lang/String.html) | toString() |
| final void | wait(long arg0, int arg1) |
| final void | wait(long arg0) |
| final void | wait() |

## Public Constructors

#### public **ChannelIOException** ([String](https://developer.android.com/reference/java/lang/String.html) message, int closeReason, int appSpecificErrorCode)

## Public Methods

#### public int **getAppSpecificErrorCode** ()

Returns the app-specific error code passed to `https://developers.google.com/android/reference/com/google/android/gms/wearable/Channel#close(com.google.android.gms.common.api.GoogleApiClient,%20int)` if that's the reason for the stream
closing, or `0` otherwise.

#### public int **getCloseReason** ()

Returns one of `https://developers.google.com/android/reference/com/google/android/gms/wearable/ChannelApi.ChannelListener#CLOSE_REASON_NORMAL`, `https://developers.google.com/android/reference/com/google/android/gms/wearable/ChannelApi.ChannelListener#CLOSE_REASON_DISCONNECTED`, `https://developers.google.com/android/reference/com/google/android/gms/wearable/ChannelApi.ChannelListener#CLOSE_REASON_REMOTE_CLOSE`, or `https://developers.google.com/android/reference/com/google/android/gms/wearable/ChannelApi.ChannelListener#CLOSE_REASON_LOCAL_CLOSE`, to indicate the reason
for the stream closing.