ChannelClient.ChannelCallback

public static abstract class ChannelClient.ChannelCallback extends Object

A callback which will be notified on changes to channels.

Constant Summary

int CLOSE_REASON_CONNECTION_TIMEOUT Value passed to onChannelClosed(ChannelClient.Channel, int, int), onInputClosed(ChannelClient.Channel, int, int) and onOutputClosed(ChannelClient.Channel, int, int) when the stream is closed due to data transmission timing out.
int CLOSE_REASON_DISCONNECTED Value passed to onChannelClosed(ChannelClient.Channel, int, int), onInputClosed(ChannelClient.Channel, int, int) and onOutputClosed(ChannelClient.Channel, int, int) when the closing is due to a remote node being disconnected.
int CLOSE_REASON_LOCAL_CLOSE Value passed to onChannelClosed(ChannelClient.Channel, int, int), onInputClosed(ChannelClient.Channel, int, int) and onOutputClosed(ChannelClient.Channel, int, int) when the stream is closed due to the local node calling ChannelClient.close(Channel) or ChannelClient.close(Channel, int).
int CLOSE_REASON_NORMAL Value passed to onInputClosed(ChannelClient.Channel, int, int) or onOutputClosed(ChannelClient.Channel, int, int) (but not onChannelClosed(ChannelClient.Channel, int, int)), when the stream was closed under normal conditions, e.g. the whole file was read, or the OutputStream on the remote node was closed normally.
int CLOSE_REASON_REMOTE_CLOSE Value passed to onChannelClosed(ChannelClient.Channel, int, int), onInputClosed(ChannelClient.Channel, int, int) and onOutputClosed(ChannelClient.Channel, int, int) when the stream is closed due to the remote node calling ChannelClient.close(Channel) or ChannelClient.close(Channel, int).

Public Constructor Summary

Public Method Summary

void
onChannelClosed(ChannelClient.Channel channel, int closeReason, int appSpecificErrorCode)
Called when a Channel is closed.
void
onChannelOpened(ChannelClient.Channel channel)
Called when a new Channel is opened by a remote node.
void
onInputClosed(ChannelClient.Channel channel, int closeReason, int appSpecificErrorCode)
Called when the input side of a Channel is closed.
void
onOutputClosed(ChannelClient.Channel channel, int closeReason, int appSpecificErrorCode)
Called when the output side of a Channel is closed.

Inherited Method Summary

Constants

public static final int CLOSE_REASON_CONNECTION_TIMEOUT

Constant Value: 4

public static final int CLOSE_REASON_DISCONNECTED

Constant Value: 1

public static final int CLOSE_REASON_LOCAL_CLOSE

public static final int CLOSE_REASON_NORMAL

Value passed to onInputClosed(ChannelClient.Channel, int, int) or onOutputClosed(ChannelClient.Channel, int, int) (but not onChannelClosed(ChannelClient.Channel, int, int)), when the stream was closed under normal conditions, e.g. the whole file was read, or the OutputStream on the remote node was closed normally.

Constant Value: 0

public static final int CLOSE_REASON_REMOTE_CLOSE

Public Constructors

public ChannelCallback ()

Public Methods

public void onChannelClosed (ChannelClient.Channel channel, int closeReason, int appSpecificErrorCode)

Called when a Channel is closed. This can happen through an explicit call to ChannelClient.close(Channel) or ChannelClient.close(Channel, int) on either side of the connection, or due to disconnecting from the remote node.

Parameters
channel
closeReason the reason for the channel closing. One of CLOSE_REASON_DISCONNECTED, CLOSE_REASON_REMOTE_CLOSE, or CLOSE_REASON_LOCAL_CLOSE.
appSpecificErrorCode the error code specified on Channel.close(GoogleApiClient), or 0 if closeReason is CLOSE_REASON_DISCONNECTED.

public void onChannelOpened (ChannelClient.Channel channel)

Called when a new Channel is opened by a remote node.

public void onInputClosed (ChannelClient.Channel channel, int closeReason, int appSpecificErrorCode)

Called when the input side of a Channel is closed.

Parameters
channel
closeReason the reason for the input closing. One of CLOSE_REASON_DISCONNECTED, CLOSE_REASON_REMOTE_CLOSE, CLOSE_REASON_LOCAL_CLOSE, or CLOSE_REASON_NORMAL
appSpecificErrorCode the error code specified on Channel.close(GoogleApiClient), or 0 if closeReason is CLOSE_REASON_DISCONNECTED or CLOSE_REASON_NORMAL.

public void onOutputClosed (ChannelClient.Channel channel, int closeReason, int appSpecificErrorCode)

Called when the output side of a Channel is closed.

Parameters
channel
closeReason the reason for the output closing. One of CLOSE_REASON_DISCONNECTED, CLOSE_REASON_REMOTE_CLOSE, CLOSE_REASON_LOCAL_CLOSE, or CLOSE_REASON_NORMAL
appSpecificErrorCode the error code specified on Channel.close(GoogleApiClient), or 0 if closeReason is CLOSE_REASON_DISCONNECTED or CLOSE_REASON_NORMAL.