add method

This commit is contained in:
Looly 2020-07-23 17:40:37 +08:00
parent 0ee4108d26
commit dd0dd65faf

View File

@ -1,14 +1,14 @@
package cn.hutool.socket.nio;
import cn.hutool.core.io.IORuntimeException;
import cn.hutool.core.io.IoUtil;
import java.io.Closeable;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.SocketChannel;
import cn.hutool.core.io.IORuntimeException;
import cn.hutool.core.io.IoUtil;
/**
* NIO客户端
*
@ -85,6 +85,16 @@ public class NioClient implements Closeable {
return this;
}
/**
* 获取SocketChannel
*
* @return SocketChannel
* @since 5.3.10
*/
public SocketChannel getChannel() {
return this.channel;
}
@Override
public void close() {
IoUtil.close(this.channel);