Modifier and Type | Class and Description |
---|---|
private static class |
Modifier and Type | Field and Description |
---|---|
private volatile boolean | |
private final ReadWriteLock | |
protected final FileDescriptor | |
private boolean | |
protected volatile InetSocketAddress | |
private boolean | |
private boolean | |
private final Object | |
private boolean | |
protected volatile InetSocketAddress | |
pack-priv static final int | |
pack-priv static final int | |
pack-priv static final int | |
pack-priv static final int | |
protected volatile int | |
protected final Object | |
private boolean | |
private final Object | |
private boolean | |
private boolean |
Access | Constructor and Description |
---|---|
pack-priv | |
pack-priv | AsynchronousSocketChannelImpl(AsynchronousChannelGroupImpl group, FileDescriptor fd, InetSocketAddress remote)
|
Modifier and Type | Method and Description |
---|---|
pack-priv final void | |
public final AsynchronousSocketChannel | 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 void | close()
Implements java. Closes this channel. |
public final Future | connect(SocketAddress
The remote address to which this channel is to be connected remote)Implements abstract java. Connects this channel. |
public final <A> void | connect(SocketAddress
The remote address to which this channel is to be connected remote, A The object to attach to the I/O operation; can be attachment, CompletionHandler<Void, ? super A> null The handler for consuming the result handler)Implements abstract java. Connects this channel. |
pack-priv final void | |
pack-priv final void | |
pack-priv final void | |
pack-priv final void | |
pack-priv final void | |
public final SocketAddress | getLocalAddress()
Implements abstract java. Implements java. Returns the socket address that this channel's socket is bound to. |
public final <T> T | getOption(SocketOption<T>
The socket option name)Implements java. Returns the value of a socket option. |
public final SocketAddress | getRemoteAddress()
Implements abstract java. Returns the remote address to which this channel's socket is connected. |
pack-priv abstract void | |
pack-priv abstract <A> Future | implConnect(SocketAddress remote, A attachment, CompletionHandler<Void, ? super A> handler)
Invoked by connect to initiate the connect operation. |
pack-priv abstract <V extends Number, A> Future | implRead(boolean isScatteringRead, ByteBuffer dst, ByteBuffer[] dsts, long timeout, TimeUnit unit, A attachment, CompletionHandler<V, ? super A> handler)
Invoked by read to initiate the I/O operation. |
pack-priv abstract <V extends Number, A> Future | implWrite(boolean isGatheringWrite, ByteBuffer src, ByteBuffer[] srcs, long timeout, TimeUnit unit, A attachment, CompletionHandler<V, ? super A> handler)
Invoked by write to initiate the I/O operation. |
public final boolean | |
pack-priv final void | |
pack-priv final void | |
pack-priv final void | |
private <V extends Number, A> Future | read(boolean isScatteringRead, ByteBuffer dst, ByteBuffer[] dsts, long timeout, TimeUnit unit, A att, CompletionHandler<V, ? super A> handler)
|
public final Future | 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 <A> void | read(ByteBuffer
The buffer into which bytes are to be transferred dst, long The maximum time for the I/O operation to complete timeout, TimeUnit The time unit of the unit, A timeout argumentThe object to attach to the I/O operation; can be attachment, CompletionHandler<Integer, ? super A> null The handler for consuming the result handler)Implements abstract java. Reads a sequence of bytes from this channel into the given buffer. |
public final <A> void | 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.length The maximum number of buffers to be accessed; must be non-negative
and no larger than length, long dsts.length - offset The maximum time for the I/O operation to complete timeout, TimeUnit The time unit of the unit, A timeout argumentThe object to attach to the I/O operation; can be attachment, CompletionHandler<Long, ? super A> null The handler for consuming the result handler)Implements abstract java. Reads a sequence of bytes from this channel into a subsequence of the given buffers. |
public final <T> AsynchronousSocketChannel | 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 final AsynchronousSocketChannel | shutdownInput()
Implements abstract java. Shutdown the connection for reading without closing the channel. |
public final AsynchronousSocketChannel | shutdownOutput()
Implements abstract java. Shutdown the connection for writing without closing the channel. |
public final Set | supportedOptions()
Implements java. Returns a set of the socket options supported by this channel. |
public final String | |
private <V extends Number, A> Future | write(boolean isGatheringWrite, ByteBuffer src, ByteBuffer[] srcs, long timeout, TimeUnit unit, A att, CompletionHandler<V, ? super A> handler)
|
public final Future | 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. |
public final <A> void | write(ByteBuffer
The buffer from which bytes are to be retrieved src, long The maximum time for the I/O operation to complete timeout, TimeUnit The time unit of the unit, A timeout argumentThe object to attach to the I/O operation; can be attachment, CompletionHandler<Integer, ? super A> null The handler for consuming the result handler)Implements abstract java. Writes a sequence of bytes to this channel from the given buffer. |
public final <A> void | 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.length The maximum number of buffers to be accessed; must be non-negative
and no larger than length, long srcs.length - offset The maximum time for the I/O operation to complete timeout, TimeUnit The time unit of the unit, A timeout argumentThe object to attach to the I/O operation; can be attachment, CompletionHandler<Long, ? super A> null The handler for consuming the result handler)Implements abstract java. Writes a sequence of bytes to this channel from a subsequence of the given buffers. |
closed | back to summary |
---|---|
private volatile boolean closed |
closeLock | back to summary |
---|---|
private final ReadWriteLock closeLock |
fd | back to summary |
---|---|
protected final FileDescriptor fd |
isReuseAddress | back to summary |
---|---|
private boolean isReuseAddress |
localAddress | back to summary |
---|---|
protected volatile InetSocketAddress localAddress |
reading | back to summary |
---|---|
private boolean reading |
readKilled | back to summary |
---|---|
private boolean readKilled |
readLock | back to summary |
---|---|
private final Object readLock |
readShutdown | back to summary |
---|---|
private boolean readShutdown |
remoteAddress | back to summary |
---|---|
protected volatile InetSocketAddress remoteAddress |
ST_CONNECTED | back to summary |
---|---|
pack-priv static final int ST_CONNECTED |
ST_PENDING | back to summary |
---|---|
pack-priv static final int ST_PENDING |
ST_UNCONNECTED | back to summary |
---|---|
pack-priv static final int ST_UNCONNECTED |
ST_UNINITIALIZED | back to summary |
---|---|
pack-priv static final int ST_UNINITIALIZED |
state | back to summary |
---|---|
protected volatile int state |
stateLock | back to summary |
---|---|
protected final Object stateLock |
writeKilled | back to summary |
---|---|
private boolean writeKilled |
writeLock | back to summary |
---|---|
private final Object writeLock |
writeShutdown | back to summary |
---|---|
private boolean writeShutdown |
writing | back to summary |
---|---|
private boolean writing |
AsynchronousSocketChannelImpl | back to summary |
---|---|
pack-priv AsynchronousSocketChannelImpl(AsynchronousChannelGroupImpl group) throws IOException |
AsynchronousSocketChannelImpl | back to summary |
---|---|
pack-priv AsynchronousSocketChannelImpl(AsynchronousChannelGroupImpl group, FileDescriptor fd, InetSocketAddress remote) throws IOException |
begin | back to summary |
---|---|
pack-priv final void begin() throws IOException Marks beginning of access to file descriptor/handle |
bind | back to summary |
---|---|
public final AsynchronousSocketChannel bind(SocketAddress local) throws IOException 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. Once an association is established then the socket remains
bound until the channel is closed. If the
|
close | back to summary |
---|---|
public final void close() throws IOException Implements java. Doc from java. Closes this channel. Any outstanding asynchronous operations upon this channel will
complete with the exception This method otherwise behaves exactly as specified by the
|
connect | back to summary |
---|---|
public final Future Implements abstract java. Doc from java. Connects this channel. This method initiates an operation to connect this channel. This
method behaves in exactly the same manner as the
|
connect | back to summary |
---|---|
public final <A> void connect(SocketAddress remote, A attachment, CompletionHandler<Void, ? super A> handler) Implements abstract java. Doc from java. Connects this channel. This method initiates an operation to connect this channel. The
This method performs exactly the same security checks as the
|
enableReading | back to summary |
---|---|
pack-priv final void enableReading(boolean killed) |
enableReading | back to summary |
---|---|
pack-priv final void enableReading() |
enableWriting | back to summary |
---|---|
pack-priv final void enableWriting(boolean killed) |
enableWriting | back to summary |
---|---|
pack-priv final void enableWriting() |
end | back to summary |
---|---|
pack-priv final void end() Marks end of access to file descriptor/handle |
getLocalAddress | back to summary |
---|---|
public final SocketAddress 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
If there is a security manager set, its
|
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 SocketAddress getRemoteAddress() throws IOException Implements abstract java. Doc from java. Returns the remote address to which this channel's socket is connected. Where the channel is bound and connected to an Internet Protocol
socket address then the return value from this method is of type
|
implClose | back to summary |
---|---|
pack-priv abstract void implClose() throws IOException Invoked to close socket and release other resources. |
implConnect | back to summary |
---|---|
pack-priv abstract <A> Future Invoked by connect to initiate the connect operation. |
implRead | back to summary |
---|---|
pack-priv abstract <V extends Number, A> Future Invoked by read to initiate the I/O operation. |
implWrite | back to summary |
---|---|
pack-priv abstract <V extends Number, A> Future Invoked by write to initiate the I/O operation. |
isOpen | back to summary |
---|---|
public final boolean isOpen() Implements java. Doc from java. Tells whether or not this channel is open.
|
killConnect | back to summary |
---|---|
pack-priv final void killConnect() |
killReading | back to summary |
---|---|
pack-priv final void killReading() |
killWriting | back to summary |
---|---|
pack-priv final void killWriting() |
read | back to summary |
---|---|
private <V extends Number, A> Future
|
read | back to summary |
---|---|
public final Future Implements abstract java. Implements java. Doc from java. Reads a sequence of bytes from this channel into the given buffer. This method initiates an asynchronous read operation to read a
sequence of bytes from this channel into the given buffer. The method
behaves in exactly the same manner as the
|
read | back to summary |
---|---|
public final <A> void read(ByteBuffer dst, long timeout, TimeUnit unit, A attachment, CompletionHandler<Integer, ? super A> handler) Implements abstract java. Doc from java. Reads a sequence of bytes from this channel into the given buffer. This method initiates an asynchronous read operation to read a
sequence of bytes from this channel into the given buffer. The If a timeout is specified and the timeout elapses before the operation
completes then the operation completes with the exception Otherwise this method works in the same manner as the
|
read | back to summary |
---|---|
public final <A> void read(ByteBuffer[] dsts, int offset, int length, long timeout, TimeUnit unit, A attachment, CompletionHandler<Long, ? super A> handler) Implements abstract java. Doc from java. Reads a sequence of bytes from this channel into a subsequence of the
given buffers. This operation, sometimes called a scattering read,
is often useful when implementing network protocols that group data into
segments consisting of one or more fixed-length headers followed by a
variable-length body. The This method initiates a read of 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
If a timeout is specified and the timeout elapses before the operation
completes then it completes with the exception
|
setOption | back to summary |
---|---|
public final <T> AsynchronousSocketChannel setOption(SocketOption<T> name, T value) throws IOException Implements abstract java. Implements java. Doc from java. Sets the value of a socket option.
|
shutdownInput | back to summary |
---|---|
public final AsynchronousSocketChannel shutdownInput() throws IOException 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 AsynchronousSocketChannel shutdownOutput() throws IOException 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
|
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 |
---|---|
private <V extends Number, A> Future
|
write | back to summary |
---|---|
public final Future Implements abstract java. Implements java. Doc from java. Writes a sequence of bytes to this channel from the given buffer. This method initiates an asynchronous write operation to write a
sequence of bytes to this channel from the given buffer. The method
behaves in exactly the same manner as the
|
write | back to summary |
---|---|
public final <A> void write(ByteBuffer src, long timeout, TimeUnit unit, A attachment, CompletionHandler<Integer, ? super A> handler) Implements abstract java. Doc from java. Writes a sequence of bytes to this channel from the given buffer. This method initiates an asynchronous write operation to write a
sequence of bytes to this channel from the given buffer. The If a timeout is specified and the timeout elapses before the operation
completes then it completes with the exception Otherwise this method works in the same manner as the
|
write | back to summary |
---|---|
public final <A> void write(ByteBuffer[] srcs, int offset, int length, long timeout, TimeUnit unit, A attachment, CompletionHandler<Long, ? super A> handler) Implements abstract java. Doc from java. Writes a sequence of bytes to this channel from a subsequence of the given
buffers. This operation, sometimes called a gathering write, is
often useful when implementing network protocols that group data into
segments consisting of one or more fixed-length headers followed by a
variable-length body. The This method initiates a write of 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
If a timeout is specified and the timeout elapses before the operation
completes then it completes with the exception
|
Modifier and Type | Field and Description |
---|---|
pack-priv static final Set |
Access | Constructor and Description |
---|---|
private |
Modifier and Type | Method and Description |
---|---|
private static Set |
defaultOptions | back to summary |
---|---|
pack-priv static final Set<SocketOption<?>> defaultOptions |
DefaultOptionsHolder | back to summary |
---|---|
private DefaultOptionsHolder() |
defaultOptions | back to summary |
---|---|
private static Set |