public class Nio2Channel extends Object implements AsynchronousByteChannel
Modifier and Type | Field and Description |
---|---|
protected SecureNio2Channel.ApplicationBufferHandler |
bufHandler |
protected static ByteBuffer |
emptyBuf |
protected AsynchronousSocketChannel |
sc |
protected boolean |
sendFile |
protected SocketWrapper<Nio2Channel> |
socket |
Constructor and Description |
---|
Nio2Channel(AsynchronousSocketChannel channel,
SecureNio2Channel.ApplicationBufferHandler bufHandler) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this channel.
|
void |
close(boolean force) |
Future<Boolean> |
flush() |
int |
getBufferSize() |
SecureNio2Channel.ApplicationBufferHandler |
getBufHandler() |
AsynchronousSocketChannel |
getIOChannel() |
SocketWrapper<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.
|
boolean |
isSendFile() |
Future<Integer> |
read(ByteBuffer dst) |
<A> void |
read(ByteBuffer dst,
A attachment,
CompletionHandler<Integer,? super A> handler) |
<A> void |
read(ByteBuffer dst,
long timeout,
TimeUnit unit,
A attachment,
CompletionHandler<Integer,? super A> handler) |
void |
reset()
Reset the channel
|
void |
setIOChannel(AsynchronousSocketChannel IOChannel) |
void |
setSendFile(boolean s) |
String |
toString() |
Future<Integer> |
write(ByteBuffer src) |
<A> void |
write(ByteBuffer[] srcs,
int offset,
int length,
long timeout,
TimeUnit unit,
A attachment,
CompletionHandler<Long,? super A> handler) |
<A> void |
write(ByteBuffer src,
A attachment,
CompletionHandler<Integer,? super A> handler) |
<A> void |
write(ByteBuffer src,
long timeout,
TimeUnit unit,
A attachment,
CompletionHandler<Integer,? super A> handler) |
protected static ByteBuffer emptyBuf
protected AsynchronousSocketChannel sc
protected SocketWrapper<Nio2Channel> socket
protected SecureNio2Channel.ApplicationBufferHandler bufHandler
protected boolean sendFile
public Nio2Channel(AsynchronousSocketChannel channel, SecureNio2Channel.ApplicationBufferHandler bufHandler)
public void reset() throws IOException
IOException
- If a problem was encountered resetting the channelpublic SocketWrapper<Nio2Channel> getSocket()
public int getBufferSize()
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in interface AsynchronousChannel
close
in interface Channel
IOException
- If an I/O error occurspublic void close(boolean force) throws IOException
IOException
public boolean isOpen()
public SecureNio2Channel.ApplicationBufferHandler getBufHandler()
public AsynchronousSocketChannel getIOChannel()
public boolean isClosing()
public boolean isHandshakeComplete()
public int handshake() throws IOException
IOException
public void setIOChannel(AsynchronousSocketChannel IOChannel)
public boolean isSendFile()
public void setSendFile(boolean s)
public Future<Integer> read(ByteBuffer dst)
read
in interface AsynchronousByteChannel
public <A> void read(ByteBuffer dst, A attachment, CompletionHandler<Integer,? super A> handler)
read
in interface AsynchronousByteChannel
public <A> void read(ByteBuffer dst, long timeout, TimeUnit unit, A attachment, CompletionHandler<Integer,? super A> handler)
public Future<Integer> write(ByteBuffer src)
write
in interface AsynchronousByteChannel
public <A> void write(ByteBuffer src, A attachment, CompletionHandler<Integer,? super A> handler)
write
in interface AsynchronousByteChannel
public <A> void write(ByteBuffer src, long timeout, TimeUnit unit, A attachment, CompletionHandler<Integer,? super A> handler)
public <A> void write(ByteBuffer[] srcs, int offset, int length, long timeout, TimeUnit unit, A attachment, CompletionHandler<Long,? super A> handler)
public Future<Boolean> flush() throws IOException
IOException
Copyright © 2000-2014 Apache Software Foundation. All Rights Reserved.