public class TlsAsynchronousSocketChannel
extends java.nio.channels.AsynchronousSocketChannel
implements java.nio.channels.CompletionHandler<java.lang.Integer,java.lang.Void>
Note: This implementation does not support attachments for reads. They are not used in AsyncMessageReader which this class is in direct support of.
Constructor and Description |
---|
TlsAsynchronousSocketChannel(java.nio.channels.AsynchronousSocketChannel in,
javax.net.ssl.SSLEngine sslEngine)
Create a new decrypting input stream.
|
Modifier and Type | Method and Description |
---|---|
java.nio.channels.AsynchronousSocketChannel |
bind(java.net.SocketAddress local) |
void |
close() |
void |
completed(java.lang.Integer result,
java.lang.Void attachment)
Completion handler for a read.
|
java.util.concurrent.Future<java.lang.Void> |
connect(java.net.SocketAddress remote) |
<A> void |
connect(java.net.SocketAddress remote,
A attachment,
java.nio.channels.CompletionHandler<java.lang.Void,? super A> hdlr) |
void |
failed(java.lang.Throwable exc,
java.lang.Void attachment) |
java.net.SocketAddress |
getLocalAddress() |
<T> T |
getOption(java.net.SocketOption<T> name) |
java.net.SocketAddress |
getRemoteAddress() |
boolean |
isOpen() |
java.util.concurrent.Future<java.lang.Integer> |
read(java.nio.ByteBuffer dest)
Unused.
|
<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> hdlr) |
<A> void |
read(java.nio.ByteBuffer dest,
long timeout,
java.util.concurrent.TimeUnit unit,
A attachment,
java.nio.channels.CompletionHandler<java.lang.Integer,? super A> hdlr)
Main entry point from caller.
|
<T> java.nio.channels.AsynchronousSocketChannel |
setOption(java.net.SocketOption<T> name,
T value) |
java.nio.channels.AsynchronousSocketChannel |
shutdownInput() |
java.nio.channels.AsynchronousSocketChannel |
shutdownOutput() |
java.util.Set<java.net.SocketOption<?>> |
supportedOptions() |
java.util.concurrent.Future<java.lang.Integer> |
write(java.nio.ByteBuffer src)
Unused.
|
<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> hdlr)
Handle a request to write an array of buffers to the channel.
|
<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> hdlr) |
public TlsAsynchronousSocketChannel(java.nio.channels.AsynchronousSocketChannel in, javax.net.ssl.SSLEngine sslEngine)
in
- The underlying inputstream to read encrypted data from.sslEngine
- A configured SSLEngine
which has already completed the handshake.public void completed(java.lang.Integer result, java.lang.Void attachment)
decryptAndDispatch()
.completed
in interface java.nio.channels.CompletionHandler<java.lang.Integer,java.lang.Void>
result
- number of processed bytesattachment
- Voidpublic void failed(java.lang.Throwable exc, java.lang.Void attachment)
failed
in interface java.nio.channels.CompletionHandler<java.lang.Integer,java.lang.Void>
public <A> void read(java.nio.ByteBuffer dest, long timeout, java.util.concurrent.TimeUnit unit, A attachment, java.nio.channels.CompletionHandler<java.lang.Integer,? super A> hdlr)
read
in class java.nio.channels.AsynchronousSocketChannel
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> hdlr)
read
in class java.nio.channels.AsynchronousSocketChannel
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in interface java.nio.channels.AsynchronousChannel
close
in interface java.nio.channels.Channel
java.io.IOException
public boolean isOpen()
isOpen
in interface java.nio.channels.Channel
public java.util.concurrent.Future<java.lang.Integer> read(java.nio.ByteBuffer dest)
read
in interface java.nio.channels.AsynchronousByteChannel
read
in class java.nio.channels.AsynchronousSocketChannel
public java.util.concurrent.Future<java.lang.Integer> write(java.nio.ByteBuffer src)
write
in interface java.nio.channels.AsynchronousByteChannel
write
in class java.nio.channels.AsynchronousSocketChannel
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> hdlr)
write
in class java.nio.channels.AsynchronousSocketChannel
srcs
- source buffers to writeoffset
- offset into buffer arraylength
- number of bufferstimeout
- ignoredunit
- ignoredattachment
- ignoredhdlr
- completion handler to be called when all buffers have been writtenpublic <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> hdlr)
write
in class java.nio.channels.AsynchronousSocketChannel
public <T> T getOption(java.net.SocketOption<T> name) throws java.io.IOException
getOption
in interface java.nio.channels.NetworkChannel
java.io.IOException
public java.util.Set<java.net.SocketOption<?>> supportedOptions()
supportedOptions
in interface java.nio.channels.NetworkChannel
public java.nio.channels.AsynchronousSocketChannel bind(java.net.SocketAddress local) throws java.io.IOException
bind
in interface java.nio.channels.NetworkChannel
bind
in class java.nio.channels.AsynchronousSocketChannel
java.io.IOException
public <T> java.nio.channels.AsynchronousSocketChannel setOption(java.net.SocketOption<T> name, T value) throws java.io.IOException
setOption
in interface java.nio.channels.NetworkChannel
setOption
in class java.nio.channels.AsynchronousSocketChannel
java.io.IOException
public java.nio.channels.AsynchronousSocketChannel shutdownInput() throws java.io.IOException
shutdownInput
in class java.nio.channels.AsynchronousSocketChannel
java.io.IOException
public java.nio.channels.AsynchronousSocketChannel shutdownOutput() throws java.io.IOException
shutdownOutput
in class java.nio.channels.AsynchronousSocketChannel
java.io.IOException
public java.net.SocketAddress getRemoteAddress() throws java.io.IOException
getRemoteAddress
in class java.nio.channels.AsynchronousSocketChannel
java.io.IOException
public <A> void connect(java.net.SocketAddress remote, A attachment, java.nio.channels.CompletionHandler<java.lang.Void,? super A> hdlr)
connect
in class java.nio.channels.AsynchronousSocketChannel
public java.util.concurrent.Future<java.lang.Void> connect(java.net.SocketAddress remote)
connect
in class java.nio.channels.AsynchronousSocketChannel
public java.net.SocketAddress getLocalAddress() throws java.io.IOException
getLocalAddress
in interface java.nio.channels.NetworkChannel
getLocalAddress
in class java.nio.channels.AsynchronousSocketChannel
java.io.IOException