io.netty.buffer.Unpooled#copyLong ( )源码实例Demo

下面列出了io.netty.buffer.Unpooled#copyLong ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: redisson   文件: Hash.java
public static String hash128toBase64(ByteBuf objectState) {
    long[] hash = hash128(objectState);

    ByteBuf buf = Unpooled.copyLong(hash[0], hash[1]);
    try {
        ByteBuf b = Base64.encode(buf);
        try {
            String s = b.toString(CharsetUtil.UTF_8);
            return s.substring(0, s.length() - 2);
        } finally {
            b.release();
        }
    } finally {
        buf.release();
    }
}
 
源代码2 项目: spring-boot-netty   文件: OnConnectController.java
@NettyOnConnect(serverName = "server1", priority = 1)
private void onConnect1(final ChannelHandlerContext ctx, final Channel channel) {
    calls.add(ON_CONNECT1);
    counter.arrive();

    final ByteBuf r1 = Unpooled.copyLong(92L);
    final ByteBuf r2 = Unpooled.copyLong(87L);

    ctx.writeAndFlush(r1);
    channel.writeAndFlush(r2);
}
 
源代码3 项目: spring-boot-netty   文件: OnConnectController.java
@SuppressWarnings("WeakerAccess")
@NettyOnConnect(serverName = "server1", priority = 2)
ByteBuf onConnect2(final ChannelHandlerContext ignored) {
    calls.add(ON_CONNECT2);
    counter.arrive();
    return Unpooled.copyLong(106L);
}
 
@NettyOnDisconnect(serverName = "server1", priority = 1)
private void onDisconnect1(final ChannelFuture future, final Channel channel) {
    calls.add(ON_DISCONNECT1);
    counter.arrive();

    final ByteBuf r1 = Unpooled.copyLong(92L);
    final ByteBuf r2 = Unpooled.copyLong(87L);

    try {
        future.channel().writeAndFlush(r1);
        channel.writeAndFlush(r2);
    } catch (final Exception ignored) {
    }
}
 
@SuppressWarnings("WeakerAccess")
@NettyOnDisconnect(serverName = "server1", priority = 2)
ByteBuf onDisconnect2() {
    calls.add(ON_DISCONNECT2);
    counter.arrive();
    return Unpooled.copyLong(106L);
}
 
源代码6 项目: redisson   文件: Hash.java
public static byte[] hash128toArray(ByteBuf objectState) {
    long[] hash = hash128(objectState);

    ByteBuf buf = Unpooled.copyLong(hash[0], hash[1]);
    try {
        byte[] dst = new byte[buf.readableBytes()];
        buf.readBytes(dst);
        return dst;
    } finally {
        buf.release();
    }
}
 
@NettyOnConnect(serverName = "server1")
public ByteBuf onConnect(final long rnd) {
    counter.arrive();
    return Unpooled.copyLong(rnd);
}
 
@NettyOnMessage(serverName = "server1")
public ByteBuf onMessage(final Long rnd) {
    counter.arrive();
    return Unpooled.copyLong(rnd);
}