public class AioClient extends Object implements Closeable
Constructor and Description |
---|
AioClient(AsynchronousSocketChannel channel,
IoAction<ByteBuffer> ioAction,
SocketConfig config)
构造
|
AioClient(InetSocketAddress address,
IoAction<ByteBuffer> ioAction)
构造
|
AioClient(InetSocketAddress address,
IoAction<ByteBuffer> ioAction,
SocketConfig config)
构造
|
Modifier and Type | Method and Description |
---|---|
void |
close()
关闭客户端
|
IoAction<ByteBuffer> |
getIoAction()
获取IO处理器
|
AioClient |
read()
从服务端读取数据
|
<T> AioClient |
setOption(SocketOption<T> name,
T value)
设置 Socket 的 Option 选项
选项见: StandardSocketOptions |
AioClient |
write(ByteBuffer data)
写数据到服务端
|
public AioClient(InetSocketAddress address, IoAction<ByteBuffer> ioAction)
address
- 地址ioAction
- IO处理类public AioClient(InetSocketAddress address, IoAction<ByteBuffer> ioAction, SocketConfig config)
address
- 地址ioAction
- IO处理类config
- 配置项public AioClient(AsynchronousSocketChannel channel, IoAction<ByteBuffer> ioAction, SocketConfig config)
channel
- AsynchronousSocketChannel
ioAction
- IO处理类config
- 配置项public <T> AioClient setOption(SocketOption<T> name, T value) throws IOException
StandardSocketOptions
T
- 选项泛型name
- SocketOption
枚举value
- SocketOption参数IOException
- IO异常public IoAction<ByteBuffer> getIoAction()
IoAction
public AioClient read()
public AioClient write(ByteBuffer data)
data
- 数据public void close()
close
in interface Closeable
close
in interface AutoCloseable
Copyright © 2024. All rights reserved.