mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
fix code
This commit is contained in:
parent
2602f91327
commit
1b3a19f07e
@ -22,6 +22,7 @@ public interface BitMap{
|
||||
* 检查是否包含值
|
||||
*
|
||||
* @param i 值
|
||||
* @return 是否包含
|
||||
*/
|
||||
boolean contains(long i);
|
||||
|
||||
@ -30,5 +31,5 @@ public interface BitMap{
|
||||
*
|
||||
* @param i 值
|
||||
*/
|
||||
public void remove(long i);
|
||||
void remove(long i);
|
||||
}
|
@ -11,7 +11,7 @@ import java.io.Serializable;
|
||||
public class IntMap implements BitMap, Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private int[] ints = null;
|
||||
private int[] ints;
|
||||
|
||||
/**
|
||||
* 构造
|
||||
@ -40,10 +40,7 @@ public class IntMap implements BitMap, Serializable {
|
||||
public boolean contains(long i) {
|
||||
int r = (int) (i / BitMap.MACHINE32);
|
||||
int c = (int) (i % BitMap.MACHINE32);
|
||||
if (((int) ((ints[r] >>> c)) & 1) == 1) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return ((int) ((ints[r] >>> c)) & 1) == 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -11,7 +11,7 @@ import java.io.Serializable;
|
||||
public class LongMap implements BitMap, Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private long[] longs = null;
|
||||
private long[] longs;
|
||||
|
||||
/**
|
||||
* 构造
|
||||
@ -40,10 +40,7 @@ public class LongMap implements BitMap, Serializable {
|
||||
public boolean contains(long i) {
|
||||
int r = (int) (i / BitMap.MACHINE64);
|
||||
long c = i % BitMap.MACHINE64;
|
||||
if (((longs[r] >>> c) & 1) == 1) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return ((longs[r] >>> c) & 1) == 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -4,14 +4,14 @@ import cn.hutool.core.util.HashUtil;
|
||||
|
||||
/**
|
||||
* 默认Bloom过滤器,使用Java自带的Hash算法
|
||||
* @author loolly
|
||||
*
|
||||
* @author loolly
|
||||
*/
|
||||
public class DefaultFilter extends AbstractFilter {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public DefaultFilter(long maxValue, int MACHINENUM) {
|
||||
super(maxValue, MACHINENUM);
|
||||
public DefaultFilter(long maxValue, int machineNumber) {
|
||||
super(maxValue, machineNumber);
|
||||
}
|
||||
|
||||
public DefaultFilter(long maxValue) {
|
||||
|
@ -5,8 +5,8 @@ import cn.hutool.core.util.HashUtil;
|
||||
public class ELFFilter extends AbstractFilter {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public ELFFilter(long maxValue, int MACHINENUM) {
|
||||
super(maxValue, MACHINENUM);
|
||||
public ELFFilter(long maxValue, int machineNumber) {
|
||||
super(maxValue, machineNumber);
|
||||
}
|
||||
|
||||
public ELFFilter(long maxValue) {
|
||||
|
@ -64,6 +64,7 @@ public class AioClient implements Closeable{
|
||||
* @param <T> 选项泛型
|
||||
* @param name {@link SocketOption} 枚举
|
||||
* @param value SocketOption参数
|
||||
* @return this
|
||||
* @throws IOException IO异常
|
||||
*/
|
||||
public <T> AioClient setOption(SocketOption<T> name, T value) throws IOException {
|
||||
@ -93,6 +94,7 @@ public class AioClient implements Closeable{
|
||||
/**
|
||||
* 写数据到服务端
|
||||
*
|
||||
* @param data 数据
|
||||
* @return this
|
||||
*/
|
||||
public AioClient write(ByteBuffer data) {
|
||||
|
@ -20,9 +20,8 @@ import cn.hutool.socket.SocketConfig;
|
||||
* 基于AIO的Socket服务端实现
|
||||
*
|
||||
* @author looly
|
||||
*
|
||||
*/
|
||||
public class AioServer implements Closeable{
|
||||
public class AioServer implements Closeable {
|
||||
private static final Log log = LogFactory.get();
|
||||
private static AcceptHandler ACCEPT_HANDLER = new AcceptHandler();
|
||||
|
||||
@ -45,7 +44,7 @@ public class AioServer implements Closeable{
|
||||
* 构造
|
||||
*
|
||||
* @param address 地址
|
||||
* @param config {@link SocketConfig} 配置项
|
||||
* @param config {@link SocketConfig} 配置项
|
||||
*/
|
||||
public AioServer(InetSocketAddress address, SocketConfig config) {
|
||||
this.config = config;
|
||||
@ -88,9 +87,10 @@ public class AioServer implements Closeable{
|
||||
* 设置 Socket 的 Option 选项<br>
|
||||
* 选项见:{@link java.net.StandardSocketOptions}
|
||||
*
|
||||
* @param <T> 选项泛型
|
||||
* @param name {@link SocketOption} 枚举
|
||||
* @param <T> 选项泛型
|
||||
* @param name {@link SocketOption} 枚举
|
||||
* @param value SocketOption参数
|
||||
* @return this
|
||||
* @throws IOException IO异常
|
||||
*/
|
||||
public <T> AioServer setOption(SocketOption<T> name, T value) throws IOException {
|
||||
@ -168,6 +168,7 @@ public class AioServer implements Closeable{
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------- Private method start
|
||||
|
||||
/**
|
||||
* 开始监听
|
||||
*
|
||||
|
@ -119,6 +119,7 @@ public class AioSession implements Closeable{
|
||||
/**
|
||||
* 写数据到目标端,并关闭输出
|
||||
*
|
||||
* @param data 数据
|
||||
* @return this
|
||||
*/
|
||||
public AioSession writeAndClose(ByteBuffer data) {
|
||||
@ -129,6 +130,7 @@ public class AioSession implements Closeable{
|
||||
/**
|
||||
* 写数据到目标端
|
||||
*
|
||||
* @param data 数据
|
||||
* @return {@link Future}
|
||||
*/
|
||||
public Future<Integer> write(ByteBuffer data) {
|
||||
@ -138,6 +140,7 @@ public class AioSession implements Closeable{
|
||||
/**
|
||||
* 写数据到目标端
|
||||
*
|
||||
* @param data 数据
|
||||
* @param handler {@link CompletionHandler}
|
||||
* @return this
|
||||
*/
|
||||
|
@ -15,7 +15,7 @@ import cn.hutool.core.io.IoUtil;
|
||||
* @author looly
|
||||
* @since 4.4.5
|
||||
*/
|
||||
public class NioClient implements Closeable{
|
||||
public class NioClient implements Closeable {
|
||||
|
||||
private SocketChannel channel;
|
||||
|
||||
@ -58,6 +58,7 @@ public class NioClient implements Closeable{
|
||||
* 当收到读取准备就绪的信号后,回调此方法,用户可读取从客户端传世来的消息
|
||||
*
|
||||
* @param buffer 服务端数据存储缓存
|
||||
* @return this
|
||||
*/
|
||||
public NioClient read(ByteBuffer buffer) {
|
||||
try {
|
||||
@ -73,6 +74,7 @@ public class NioClient implements Closeable{
|
||||
* 当收到写出准备就绪的信号后,回调此方法,用户可向客户端发送消息
|
||||
*
|
||||
* @param datas 发送的数据
|
||||
* @return this
|
||||
*/
|
||||
public NioClient write(ByteBuffer... datas) {
|
||||
try {
|
||||
|
Loading…
x
Reference in New Issue
Block a user