AFSocketAddress that is supported by this type.
| Modifier and Type | Class and Description |
|---|---|
| protected static interface | AFSocketChannel.
The concrete A extends AFSocketAddress>AFSocketAddress that is supported by this type.A reference to a method that provides an |
| Modifier and Type | Field and Description |
|---|---|
| private final @NonNull AFSocket | |
| private final AtomicBoolean |
| Access | Constructor and Description |
|---|---|
| protected | AFSocketChannel(AFSocket<A>
The socket. socket, AFSelectorProvider<A> The sp)SelectorProvider.Creates a new socket channel for the given socket, using the given |
| Modifier and Type | Method and Description |
|---|---|
| public final AFSocketChannel | bind(SocketAddress
The address to bind the socket, or local)null to bind
the socket to an automatically assigned socket addressImplements abstract java. Implements java. Binds the channel's socket to a local address. |
| public final boolean | connect(SocketAddress
The remote address to which this channel is to be connected remote)Implements abstract java. Connects this channel's socket. |
| public final void | ensureAncillaryReceiveBufferSize(int
The minimum size (in bytes). minSize)Implements org. Ensures a minimum ancillary receive buffer size. |
| public final boolean | finishConnect()
Implements abstract java. Finishes the process of connecting a socket channel. |
| pack-priv final AFSocketCore | |
| protected final AFSocket | |
| public final int | getAncillaryReceiveBufferSize()
Implements org. Returns the size of the receive buffer for ancillary messages (in bytes). |
| public final FileDescriptor | getFileDescriptor()
Implements org. Returns the corresponding |
| public final A | getLocalAddress()
Implements abstract java. Implements java. Returns the socket address that this channel's socket is bound to. |
| public final A | getLocalSocketAddress()
Implements org. Returns the socket's local socket address, or |
| public final <T> T | getOption(SocketOption<T>
The socket option name)Implements java. Returns the value of a socket option. |
| public final A | getRemoteAddress()
Implements abstract java. Returns the remote address to which this channel's socket is connected. |
| public final A | getRemoteSocketAddress()
Implements org. Returns the socket's remote socket address, or |
| protected final void | implCloseSelectableChannel()
Implements abstract java. Closes this selectable channel. |
| protected final void | implConfigureBlocking(boolean
If block)true then this channel will be placed in
blocking mode; if false then it will be placed
non-blocking modeImplements abstract java. Adjusts this channel's blocking mode. |
| public final boolean | isConnected()
Implements abstract java. Tells whether or not this channel's network socket is connected. |
| public final boolean | isConnectionPending()
Implements abstract java. Tells whether or not a connection operation is in progress on this channel. |
| protected static final < The concrete A extends AFSocketAddress> AFSocketChannelAFSocketAddress that is supported by this type. | Returns: The new channelThe AFSocketChannel constructor. supplierOpens a socket channel. |
| protected static final < The concrete A extends AFSocketAddress> AFSocketChannelAFSocketAddress that is supported by this type. | Returns: The new channelThe AFSocketChannel constructor. supplier,The socket address to connect to. remote)Opens a socket channel, connecting to the given socket address. |
| public static SocketChannel | Returns: The newSocketChannel.The protocol family. family)Hides java. Opens a socket channel. |
| public final int | read(ByteBuffer
The buffer into which bytes are to be transferred dst)Implements abstract java. Implements java. Reads a sequence of bytes from this channel into the given buffer. |
| public final long | read(ByteBuffer[]
The buffers into which bytes are to be transferred dsts, int The offset within the buffer array of the first buffer into
which bytes are to be transferred; must be non-negative and no
larger than offset, int dsts.lengthThe maximum number of buffers to be accessed; must be
non-negative and no larger than
length)dsts.length - offsetImplements abstract java. Implements java. Reads a sequence of bytes from this channel into a subsequence of the given buffers. |
| public final void | setAncillaryReceiveBufferSize(int
The size. size)Implements org. Sets the size of the receive buffer for ancillary messages (in bytes). |
| public final <T> AFSocketChannel | setOption(SocketOption<T>
The socket option name, T The value of the socket option. A value of value)null may be
a valid value for some socket options.Implements abstract java. Implements java. Sets the value of a socket option. |
| public void | setShutdownOnClose(boolean
true if enabled.Implements org. Configures whether the socket should be shutdown upon |
| public final AFSocketChannel | shutdownInput()
Implements abstract java. Shutdown the connection for reading without closing the channel. |
| public final AFSocketChannel | shutdownOutput()
Implements abstract java. Shutdown the connection for writing without closing the channel. |
| public final AFSocket | socket()
Implements abstract java. Retrieves a socket associated with this channel. |
| public final Set | supportedOptions()
Implements java. Returns a set of the socket options supported by this channel. |
| public final String | |
| public final long | write(ByteBuffer[]
The buffers from which bytes are to be retrieved srcs, int The offset within the buffer array of the first buffer from
which bytes are to be retrieved; must be non-negative and no
larger than offset, int srcs.lengthThe maximum number of buffers to be accessed; must be
non-negative and no larger than
length)srcs.length - offsetImplements abstract java. Implements java. Writes a sequence of bytes to this channel from a subsequence of the given buffers. |
| public final int | write(ByteBuffer
The buffer from which bytes are to be retrieved src)Implements abstract java. Implements java. Writes a sequence of bytes to this channel from the given buffer. |
| afSocket | back to summary |
|---|---|
| private final @NonNull AFSocket<A> afSocket | |
| connectPending | back to summary |
|---|---|
| private final AtomicBoolean connectPending | |
| AFSocketChannel | back to summary |
|---|---|
| protected AFSocketChannel(AFSocket<A> socket, AFSelectorProvider<A> sp) Creates a new socket channel for the given socket, using the given
| |
| bind | back to summary |
|---|---|
| public final AFSocketChannel Implements abstract java. Implements java. Doc from java. Binds the channel's socket to a local address. This method is used to establish an association between the socket
and a local address. For Internet Protocol sockets, once an
association is established then the socket remains bound until the
channel is closed. If the
| |
| connect | back to summary |
|---|---|
| public final boolean connect(SocketAddress remote) throws IOException Implements abstract java. Doc from java. Connects this channel's socket. If this channel is in non-blocking mode then an invocation of this
method initiates a non-blocking connection operation. If the connection
is established immediately, as can happen with a local connection, then
this method returns If this channel is in blocking mode then an invocation of this method will block until the connection is established or an I/O error occurs. This method may be invoked at any time. If a read or write operation upon this channel is invoked while an invocation of this method is in progress then that operation will first block until this invocation is complete. If a connection attempt is initiated but fails, that is, if an invocation of this method throws a checked exception, then the channel will be closed.
| |
| ensureAncillaryReceiveBufferSize | back to summary |
|---|---|
| public final void ensureAncillaryReceiveBufferSize(int minSize) Implements org. Doc from org. Ensures a minimum ancillary receive buffer size.
| |
| finishConnect | back to summary |
|---|---|
| public final boolean finishConnect() throws IOException Implements abstract java. Doc from java. Finishes the process of connecting a socket channel. A non-blocking connection operation is initiated by placing a socket
channel in non-blocking mode and then invoking its If this channel is already connected then this method will not block
and will immediately return This method may be invoked at any time. If a read or write operation upon this channel is invoked while an invocation of this method is in progress then that operation will first block until this invocation is complete. If a connection attempt fails, that is, if an invocation of this method throws a checked exception, then the channel will be closed.
| |
| getAFCore | back to summary |
|---|---|
| pack-priv final AFSocketCore getAFCore() | |
| getAFSocket | back to summary |
|---|---|
| protected final AFSocket Returns the corresponding
| |
| getAncillaryReceiveBufferSize | back to summary |
|---|---|
| public final int getAncillaryReceiveBufferSize() Implements org. Doc from org. Returns the size of the receive buffer for ancillary messages (in bytes).
| |
| getFileDescriptor | back to summary |
|---|---|
| public final FileDescriptor getFileDescriptor() throws IOException Implements org. Doc from org. Returns the corresponding
| |
| getLocalAddress | back to summary |
|---|---|
| public final A getLocalAddress() throws IOException Implements abstract java. Implements java. Doc from java. Returns the socket address that this channel's socket is bound to. Where the channel is Where the channel is bound to a Unix Domain socket address, the socket
address is a
| |
| getLocalSocketAddress | back to summary |
|---|---|
| public final A getLocalSocketAddress() Implements org. Doc from org. Returns the socket's local socket address, or
| |
| getOption | back to summary |
|---|---|
| public final <T> T getOption(SocketOption<T> name) throws IOException Implements java. Doc from java. Returns the value of a socket option.
| |
| getRemoteAddress | back to summary |
|---|---|
| public final A getRemoteAddress() throws IOException Implements abstract java. Doc from java. Returns the remote address to which this channel's socket is connected. Where the channel's socket is bound and connected to an Internet
Protocol socket address then the return value is of type
Where the channel's socket is bound and connected to a Unix Domain
socket address, the returned address is a
| |
| getRemoteSocketAddress | back to summary |
|---|---|
| public final A getRemoteSocketAddress() Implements org. Doc from org. Returns the socket's remote socket address, or
| |
| implCloseSelectableChannel | back to summary |
|---|---|
| protected final void implCloseSelectableChannel() throws IOException Implements abstract java. Doc from java. Closes this selectable channel. This method is invoked by the An implementation of this method must arrange for any other thread that is blocked in an I/O operation upon this channel to return immediately, either by throwing an exception or by returning normally.
| |
| implConfigureBlocking | back to summary |
|---|---|
| protected final void implConfigureBlocking(boolean block) throws IOException Implements abstract java. Doc from java. Adjusts this channel's blocking mode. This method is invoked by the
| |
| isConnected | back to summary |
|---|---|
| public final boolean isConnected() Implements abstract java. Doc from java. Tells whether or not this channel's network socket is connected. | |
| isConnectionPending | back to summary |
|---|---|
| public final boolean isConnectionPending() Implements abstract java. Doc from java. Tells whether or not a connection operation is in progress on this channel.
| |
| open | back to summary |
|---|---|
| protected static final <A extends AFSocketAddress> AFSocketChannel Opens a socket channel.
| |
| open | back to summary |
|---|---|
| protected static final <A extends AFSocketAddress> AFSocketChannel Opens a socket channel, connecting to the given socket address.
| |
| open | back to summary |
|---|---|
| public static SocketChannel open(ProtocolFamily family) throws IOException Hides java. Opens a socket channel. The
If the
| |
| read | back to summary |
|---|---|
| public final int read(ByteBuffer dst) throws IOException Implements abstract java. Implements java. Doc from java. Reads a sequence of bytes from this channel into the given buffer. An attempt is made to read up to r bytes from the channel,
where r is the number of bytes remaining in the buffer, that is,
Suppose that a byte sequence of length n is read, where
A read operation might not fill the buffer, and in fact it might not read any bytes at all. Whether or not it does so depends upon the nature and state of the channel. A socket channel in non-blocking mode, for example, cannot read any more bytes than are immediately available from the socket's input buffer; similarly, a file channel cannot read any more bytes than remain in the file. It is guaranteed, however, that if a channel is in blocking mode and there is at least one byte remaining in the buffer then this method will block until at least one byte is read. This method may be invoked at any time. If another thread has already initiated a read operation upon this channel, however, then an invocation of this method will block until the first operation is complete.
| |
| read | back to summary |
|---|---|
| public final long read(ByteBuffer[] dsts, int offset, int length) throws IOException Implements abstract java. Implements java. Doc from java. Reads a sequence of bytes from this channel into a subsequence of the given buffers. An invocation of this method attempts to read up to r bytes from this channel, where r is the total number of bytes remaining in the specified subsequence of the given buffer array, that is, dsts[offset].remaining() + dsts[offset+1].remaining() + ... + dsts[offset+length-1].remaining() Suppose that a byte sequence of length n is read, where
This method may be invoked at any time. If another thread has already initiated a read operation upon this channel, however, then an invocation of this method will block until the first operation is complete.
| |
| setAncillaryReceiveBufferSize | back to summary |
|---|---|
| public final void setAncillaryReceiveBufferSize(int size) Implements org. Doc from org. Sets the size of the receive buffer for ancillary messages (in bytes). To disable handling ancillary messages, set it to 0 (default).
| |
| setOption | back to summary |
|---|---|
| public final <T> AFSocketChannel Implements abstract java. Implements java. Doc from java. Sets the value of a socket option.
| |
| setShutdownOnClose | back to summary |
|---|---|
| public void setShutdownOnClose(boolean enabled) Implements org. Doc from org. Configures whether the socket should be shutdown upon
| |
| shutdownInput | back to summary |
|---|---|
| public final AFSocketChannel Implements abstract java. Doc from java. Shutdown the connection for reading without closing the channel. Once shutdown for reading then further reads on the channel will
return
| |
| shutdownOutput | back to summary |
|---|---|
| public final AFSocketChannel Implements abstract java. Doc from java. Shutdown the connection for writing without closing the channel. Once shutdown for writing then further attempts to write to the
channel will throw
| |
| socket | back to summary |
|---|---|
| public final AFSocket Implements abstract java. Doc from java. Retrieves a socket associated with this channel.
| |
| supportedOptions | back to summary |
|---|---|
| public final Set Implements java. Doc from java. Returns a set of the socket options supported by this channel. This method will continue to return the set of options even after the channel has been closed.
| |
| toString | back to summary |
|---|---|
| public final String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- | |
| write | back to summary |
|---|---|
| public final long write(ByteBuffer[] srcs, int offset, int length) throws IOException Implements abstract java. Implements java. Doc from java. Writes a sequence of bytes to this channel from a subsequence of the given buffers. An attempt is made to write up to r bytes to this channel, where r is the total number of bytes remaining in the specified subsequence of the given buffer array, that is, srcs[offset].remaining() + srcs[offset+1].remaining() + ... + srcs[offset+length-1].remaining() Suppose that a byte sequence of length n is written, where
Unless otherwise specified, a write operation will return only after writing all of the r requested bytes. Some types of channels, depending upon their state, may write only some of the bytes or possibly none at all. A socket channel in non-blocking mode, for example, cannot write any more bytes than are free in the socket's output buffer. This method may be invoked at any time. If another thread has already initiated a write operation upon this channel, however, then an invocation of this method will block until the first operation is complete.
| |
| write | back to summary |
|---|---|
| public final int write(ByteBuffer src) throws IOException Implements abstract java. Implements java. Doc from java. Writes a sequence of bytes to this channel from the given buffer. An attempt is made to write up to r bytes to the channel,
where r is the number of bytes remaining in the buffer, that is,
Suppose that a byte sequence of length n is written, where
Unless otherwise specified, a write operation will return only after writing all of the r requested bytes. Some types of channels, depending upon their state, may write only some of the bytes or possibly none at all. A socket channel in non-blocking mode, for example, cannot write any more bytes than are free in the socket's output buffer. This method may be invoked at any time. If another thread has already initiated a write operation upon this channel, however, then an invocation of this method will block until the first operation is complete.
| |
AFSocketAddress that is supported by this type.
AFSocket instance.
| Modifier and Type | Method and Description |
|---|---|
| public AFSocket |
| newInstance | back to summary |
|---|---|
| public AFSocket Returns a new
| |