类 TlsAsynchronousSocketChannel
- java.lang.Object
-
- java.nio.channels.AsynchronousSocketChannel
-
- com.mysql.cj.protocol.TlsAsynchronousSocketChannel
-
- 所有已实现的接口:
Closeable,AutoCloseable,AsynchronousByteChannel,AsynchronousChannel,Channel,CompletionHandler<Integer,Void>,NetworkChannel
public class TlsAsynchronousSocketChannel extends AsynchronousSocketChannel implements CompletionHandler<Integer,Void>
FilterInputStream-esque byte channel that decrypts incoming packets. We proxy calls to the read method from the caller. We replace the provided completion handler with our own handler that decrypts the incoming message and an then delegates to the original handler.Note: This implementation does not support attachments for reads. They are not used in AsyncMessageReader which this class is in direct support of.
-
-
构造器概要
构造器 构造器 说明 TlsAsynchronousSocketChannel(AsynchronousSocketChannel in, SSLEngine sslEngine)Create a new decrypting input stream.
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 AsynchronousSocketChannelbind(SocketAddress local)voidclose()voidcompleted(Integer result, Void attachment)Completion handler for a read.Future<Void>connect(SocketAddress remote)<A> voidconnect(SocketAddress remote, A attachment, CompletionHandler<Void,? super A> hdlr)voidfailed(Throwable exc, Void attachment)SocketAddressgetLocalAddress()<T> TgetOption(SocketOption<T> name)SocketAddressgetRemoteAddress()booleanisOpen()Future<Integer>read(ByteBuffer dest)Unused.<A> voidread(ByteBuffer[] dsts, int offset, int length, long timeout, TimeUnit unit, A attachment, CompletionHandler<Long,? super A> hdlr)<A> voidread(ByteBuffer dest, long timeout, TimeUnit unit, A attachment, CompletionHandler<Integer,? super A> hdlr)Main entry point from caller.<T> AsynchronousSocketChannelsetOption(SocketOption<T> name, T value)AsynchronousSocketChannelshutdownInput()AsynchronousSocketChannelshutdownOutput()Set<SocketOption<?>>supportedOptions()Future<Integer>write(ByteBuffer src)Unused.<A> voidwrite(ByteBuffer[] srcs, int offset, int length, long timeout, TimeUnit unit, A attachment, CompletionHandler<Long,? super A> hdlr)Handle a request to write an array of buffers to the channel.<A> voidwrite(ByteBuffer src, long timeout, TimeUnit unit, A attachment, CompletionHandler<Integer,? super A> hdlr)
-
-
-
构造器详细资料
-
TlsAsynchronousSocketChannel
public TlsAsynchronousSocketChannel(AsynchronousSocketChannel in, SSLEngine sslEngine)
Create a new decrypting input stream.- 参数:
in- The underlying inputstream to read encrypted data from.sslEngine- A configuredSSLEnginewhich has already completed the handshake.
-
-
方法详细资料
-
completed
public void completed(Integer result, Void attachment)
Completion handler for a read. Prepare the buffer for decryption and continue withdecryptAndDispatch().- 指定者:
completed在接口中CompletionHandler<Integer,Void>- 参数:
result- number of processed bytesattachment- Void
-
failed
public void failed(Throwable exc, Void attachment)
- 指定者:
failed在接口中CompletionHandler<Integer,Void>
-
read
public <A> void read(ByteBuffer dest, long timeout, TimeUnit unit, A attachment, CompletionHandler<Integer,? super A> hdlr)
Main entry point from caller.- 指定者:
read在类中AsynchronousSocketChannel
-
read
public <A> void read(ByteBuffer[] dsts, int offset, int length, long timeout, TimeUnit unit, A attachment, CompletionHandler<Long,? super A> hdlr)
- 指定者:
read在类中AsynchronousSocketChannel
-
close
public void close() throws IOException- 指定者:
close在接口中AsynchronousChannel- 指定者:
close在接口中AutoCloseable- 指定者:
close在接口中Channel- 指定者:
close在接口中Closeable- 抛出:
IOException
-
read
public Future<Integer> read(ByteBuffer dest)
Unused. Should not be called.- 指定者:
read在接口中AsynchronousByteChannel- 指定者:
read在类中AsynchronousSocketChannel
-
write
public Future<Integer> write(ByteBuffer src)
Unused. Should not be called.- 指定者:
write在接口中AsynchronousByteChannel- 指定者:
write在类中AsynchronousSocketChannel
-
write
public <A> void write(ByteBuffer[] srcs, int offset, int length, long timeout, TimeUnit unit, A attachment, CompletionHandler<Long,? super A> hdlr)
Handle a request to write an array of buffers to the channel. We build one or more encrypted packets and write them to the server.- 指定者:
write在类中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 written
-
write
public <A> void write(ByteBuffer src, long timeout, TimeUnit unit, A attachment, CompletionHandler<Integer,? super A> hdlr)
- 指定者:
write在类中AsynchronousSocketChannel
-
getOption
public <T> T getOption(SocketOption<T> name) throws IOException
- 指定者:
getOption在接口中NetworkChannel- 抛出:
IOException
-
supportedOptions
public Set<SocketOption<?>> supportedOptions()
- 指定者:
supportedOptions在接口中NetworkChannel
-
bind
public AsynchronousSocketChannel bind(SocketAddress local) throws IOException
- 指定者:
bind在接口中NetworkChannel- 指定者:
bind在类中AsynchronousSocketChannel- 抛出:
IOException
-
setOption
public <T> AsynchronousSocketChannel setOption(SocketOption<T> name, T value) throws IOException
- 指定者:
setOption在接口中NetworkChannel- 指定者:
setOption在类中AsynchronousSocketChannel- 抛出:
IOException
-
shutdownInput
public AsynchronousSocketChannel shutdownInput() throws IOException
- 指定者:
shutdownInput在类中AsynchronousSocketChannel- 抛出:
IOException
-
shutdownOutput
public AsynchronousSocketChannel shutdownOutput() throws IOException
- 指定者:
shutdownOutput在类中AsynchronousSocketChannel- 抛出:
IOException
-
getRemoteAddress
public SocketAddress getRemoteAddress() throws IOException
- 指定者:
getRemoteAddress在类中AsynchronousSocketChannel- 抛出:
IOException
-
connect
public <A> void connect(SocketAddress remote, A attachment, CompletionHandler<Void,? super A> hdlr)
- 指定者:
connect在类中AsynchronousSocketChannel
-
connect
public Future<Void> connect(SocketAddress remote)
- 指定者:
connect在类中AsynchronousSocketChannel
-
getLocalAddress
public SocketAddress getLocalAddress() throws IOException
- 指定者:
getLocalAddress在接口中NetworkChannel- 指定者:
getLocalAddress在类中AsynchronousSocketChannel- 抛出:
IOException
-
-