public class Nio2Channel
extends java.lang.Object
implements java.nio.channels.AsynchronousByteChannel
| Modifier and Type | Class and Description |
|---|---|
static class |
Nio2Channel.ClosedNio2Channel |
| Modifier and Type | Field and Description |
|---|---|
protected SocketBufferHandler |
bufHandler |
protected static java.nio.ByteBuffer |
emptyBuf |
protected java.nio.channels.AsynchronousSocketChannel |
sc |
protected SocketWrapperBase<Nio2Channel> |
socket |
| Constructor and Description |
|---|
Nio2Channel(SocketBufferHandler bufHandler) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes this channel.
|
void |
close(boolean force)
Close the connection.
|
java.util.concurrent.Future<java.lang.Boolean> |
flush() |
void |
free()
Free the channel memory
|
protected ApplicationBufferHandler |
getAppReadBufHandler() |
SocketBufferHandler |
getBufHandler() |
java.nio.channels.AsynchronousSocketChannel |
getIOChannel() |
SocketWrapperBase<Nio2Channel> |
getSocket() |
int |
handshake()
Performs SSL handshake hence is a no-op for the non-secure
implementation.
|
boolean |
isClosing() |
boolean |
isHandshakeComplete() |
boolean |
isOpen()
Tells whether or not this channel is open.
|
java.util.concurrent.Future<java.lang.Integer> |
read(java.nio.ByteBuffer dst) |
<A> void |
read(java.nio.ByteBuffer[] dsts,
int offset,
int length,
long timeout,
java.util.concurrent.TimeUnit unit,
A attachment,
java.nio.channels.CompletionHandler<java.lang.Long,? super A> handler) |
<A> void |
read(java.nio.ByteBuffer dst,
A attachment,
java.nio.channels.CompletionHandler<java.lang.Integer,? super A> handler) |
<A> void |
read(java.nio.ByteBuffer dst,
long timeout,
java.util.concurrent.TimeUnit unit,
A attachment,
java.nio.channels.CompletionHandler<java.lang.Integer,? super A> handler) |
void |
reset(java.nio.channels.AsynchronousSocketChannel channel,
SocketWrapperBase<Nio2Channel> socket)
Reset the channel.
|
void |
setAppReadBufHandler(ApplicationBufferHandler handler) |
java.lang.String |
toString() |
java.util.concurrent.Future<java.lang.Integer> |
write(java.nio.ByteBuffer src) |
<A> void |
write(java.nio.ByteBuffer[] srcs,
int offset,
int length,
long timeout,
java.util.concurrent.TimeUnit unit,
A attachment,
java.nio.channels.CompletionHandler<java.lang.Long,? super A> handler) |
<A> void |
write(java.nio.ByteBuffer src,
A attachment,
java.nio.channels.CompletionHandler<java.lang.Integer,? super A> handler) |
<A> void |
write(java.nio.ByteBuffer src,
long timeout,
java.util.concurrent.TimeUnit unit,
A attachment,
java.nio.channels.CompletionHandler<java.lang.Integer,? super A> handler) |
protected static final java.nio.ByteBuffer emptyBuf
protected java.nio.channels.AsynchronousSocketChannel sc
protected SocketWrapperBase<Nio2Channel> socket
protected final SocketBufferHandler bufHandler
public Nio2Channel(SocketBufferHandler bufHandler)
public void reset(java.nio.channels.AsynchronousSocketChannel channel,
SocketWrapperBase<Nio2Channel> socket)
throws java.io.IOException
channel - The new async channel to associate with this NIO2 channelsocket - The new socket to associate with this NIO2 channeljava.io.IOException - If a problem was encountered resetting the channelpublic void free()
public SocketWrapperBase<Nio2Channel> getSocket()
public void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in interface java.nio.channels.AsynchronousChannelclose in interface java.nio.channels.Channeljava.io.IOException - If an I/O error occurspublic void close(boolean force)
throws java.io.IOException
force - Should the underlying socket be forcibly closed?java.io.IOException - If closing the secure channel fails.public boolean isOpen()
isOpen in interface java.nio.channels.Channelpublic SocketBufferHandler getBufHandler()
public java.nio.channels.AsynchronousSocketChannel getIOChannel()
public boolean isClosing()
public boolean isHandshakeComplete()
public int handshake()
throws java.io.IOException
java.io.IOException - Never for non-secure channelpublic java.lang.String toString()
toString in class java.lang.Objectpublic java.util.concurrent.Future<java.lang.Integer> read(java.nio.ByteBuffer dst)
read in interface java.nio.channels.AsynchronousByteChannelpublic <A> void read(java.nio.ByteBuffer dst,
A attachment,
java.nio.channels.CompletionHandler<java.lang.Integer,? super A> handler)
read in interface java.nio.channels.AsynchronousByteChannelpublic <A> void read(java.nio.ByteBuffer dst,
long timeout,
java.util.concurrent.TimeUnit unit,
A attachment,
java.nio.channels.CompletionHandler<java.lang.Integer,? super A> handler)
public <A> void read(java.nio.ByteBuffer[] dsts,
int offset,
int length,
long timeout,
java.util.concurrent.TimeUnit unit,
A attachment,
java.nio.channels.CompletionHandler<java.lang.Long,? super A> handler)
public java.util.concurrent.Future<java.lang.Integer> write(java.nio.ByteBuffer src)
write in interface java.nio.channels.AsynchronousByteChannelpublic <A> void write(java.nio.ByteBuffer src,
A attachment,
java.nio.channels.CompletionHandler<java.lang.Integer,? super A> handler)
write in interface java.nio.channels.AsynchronousByteChannelpublic <A> void write(java.nio.ByteBuffer src,
long timeout,
java.util.concurrent.TimeUnit unit,
A attachment,
java.nio.channels.CompletionHandler<java.lang.Integer,? super A> handler)
public <A> void write(java.nio.ByteBuffer[] srcs,
int offset,
int length,
long timeout,
java.util.concurrent.TimeUnit unit,
A attachment,
java.nio.channels.CompletionHandler<java.lang.Long,? super A> handler)
public java.util.concurrent.Future<java.lang.Boolean> flush()
public void setAppReadBufHandler(ApplicationBufferHandler handler)
protected ApplicationBufferHandler getAppReadBufHandler()
Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.