Package org.apache.tomcat.websocket
Class AsyncChannelWrapperNonSecure
- java.lang.Object
-
- org.apache.tomcat.websocket.AsyncChannelWrapperNonSecure
-
- All Implemented Interfaces:
AsyncChannelWrapper
public class AsyncChannelWrapperNonSecure extends java.lang.Object implements AsyncChannelWrapper
Generally, just passes calls straight to the wrappedAsynchronousSocketChannel. In some cases exceptions may be swallowed to save them being swallowed by the calling code.
-
-
Constructor Summary
Constructors Constructor Description AsyncChannelWrapperNonSecure(java.nio.channels.AsynchronousSocketChannel socketChannel)Constructs a new non-secure wrapper for the given channel.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes the underlying channel.java.net.SocketAddressgetLocalAddress()Returns the local address to which the channel is bound.java.util.concurrent.Future<java.lang.Void>handshake()Performs the SSL/TLS handshake.java.util.concurrent.Future<java.lang.Integer>read(java.nio.ByteBuffer dst)Reads data from the channel into the given buffer.<B,A extends B>
voidread(java.nio.ByteBuffer dst, A attachment, java.nio.channels.CompletionHandler<java.lang.Integer,B> handler)Reads data from the channel into the given buffer with a completion handler.java.util.concurrent.Future<java.lang.Integer>write(java.nio.ByteBuffer src)Writes data from the given buffer to the channel.<B,A extends B>
voidwrite(java.nio.ByteBuffer[] srcs, int offset, int length, long timeout, java.util.concurrent.TimeUnit unit, A attachment, java.nio.channels.CompletionHandler<java.lang.Long,B> handler)Writes data from the given buffers to the channel with a completion handler.
-
-
-
Method Detail
-
read
public java.util.concurrent.Future<java.lang.Integer> read(java.nio.ByteBuffer dst)
Description copied from interface:AsyncChannelWrapperReads data from the channel into the given buffer.- Specified by:
readin interfaceAsyncChannelWrapper- Parameters:
dst- the buffer into which data is to be read- Returns:
- a Future holding the number of bytes read
-
read
public <B,A extends B> void read(java.nio.ByteBuffer dst, A attachment, java.nio.channels.CompletionHandler<java.lang.Integer,B> handler)Description copied from interface:AsyncChannelWrapperReads data from the channel into the given buffer with a completion handler.- Specified by:
readin interfaceAsyncChannelWrapper- Type Parameters:
B- the attachment typeA- the attachment subtype- Parameters:
dst- the buffer into which data is to be readattachment- the object to attach to the taskhandler- the handler to use on completion
-
write
public java.util.concurrent.Future<java.lang.Integer> write(java.nio.ByteBuffer src)
Description copied from interface:AsyncChannelWrapperWrites data from the given buffer to the channel.- Specified by:
writein interfaceAsyncChannelWrapper- Parameters:
src- the buffer from which data is to be written- Returns:
- a Future holding the number of bytes written
-
write
public <B,A extends B> 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,B> handler)Description copied from interface:AsyncChannelWrapperWrites data from the given buffers to the channel with a completion handler.- Specified by:
writein interfaceAsyncChannelWrapper- Type Parameters:
B- the attachment typeA- the attachment subtype- Parameters:
srcs- the buffers from which data is to be writtenoffset- the offset within the buffer arraylength- the number of buffers to writetimeout- the maximum time to waitunit- the time unit of the timeoutattachment- the object to attach to the taskhandler- the handler to use on completion
-
close
public void close()
Description copied from interface:AsyncChannelWrapperCloses the underlying channel.- Specified by:
closein interfaceAsyncChannelWrapper
-
handshake
public java.util.concurrent.Future<java.lang.Void> handshake()
Description copied from interface:AsyncChannelWrapperPerforms the SSL/TLS handshake.- Specified by:
handshakein interfaceAsyncChannelWrapper- Returns:
- a Future that completes when the handshake is finished
-
getLocalAddress
public java.net.SocketAddress getLocalAddress() throws java.io.IOExceptionDescription copied from interface:AsyncChannelWrapperReturns the local address to which the channel is bound.- Specified by:
getLocalAddressin interfaceAsyncChannelWrapper- Returns:
- the local socket address, or null if not bound
- Throws:
java.io.IOException- if an I/O error occurs
-
-