io.netty.buffer.ByteBuf.setLong()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(4.5k)|赞(0)|评价(0)|浏览(135)

本文整理了Java中io.netty.buffer.ByteBuf.setLong()方法的一些代码示例,展示了ByteBuf.setLong()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ByteBuf.setLong()方法的具体详情如下:
包路径:io.netty.buffer.ByteBuf
类名称:ByteBuf
方法名:setLong

ByteBuf.setLong介绍

[英]Sets the specified 64-bit long integer at the specified absolute index in this buffer. This method does not modify readerIndex or writerIndex of this buffer.
[中]在此缓冲区中指定的绝对索引处设置指定的64位长整数。此方法不修改此缓冲区的readerIndex或writerIndex。

代码示例

代码示例来源:origin: netty/netty

@Override
public ByteBuf setLongLE(int index, long value) {
  buf.setLong(index, value);
  return this;
}

代码示例来源:origin: netty/netty

@Override
public ByteBuf setLong(int index, long value) {
  buf.setLong(index, value);
  return this;
}

代码示例来源:origin: redisson/redisson

@Override
public ByteBuf setLong(int index, long value) {
  buf.setLong(index, value);
  return this;
}

代码示例来源:origin: redisson/redisson

@Override
public ByteBuf setLongLE(int index, long value) {
  buf.setLong(index, value);
  return this;
}

代码示例来源:origin: netty/netty

@Override
public ByteBuf setLong(int index, long value) {
  buf.setLong(index, ByteBufUtil.swapLong(value));
  return this;
}

代码示例来源:origin: netty/netty

@Override
public ByteBuf setLong(int index, long value) {
  unwrap().setLong(index, value);
  return this;
}

代码示例来源:origin: netty/netty

@Override
protected void _setLong(int index, long value) {
  unwrap().setLong(index, value);
}

代码示例来源:origin: eclipse-vertx/vert.x

public Buffer setLong(int pos, long l) {
 ensureWritable(pos, 8);
 buffer.setLong(pos, l);
 return this;
}

代码示例来源:origin: redisson/redisson

@Override
public ByteBuf setLong(int index, long value) {
  buf.setLong(index, ByteBufUtil.swapLong(value));
  return this;
}

代码示例来源:origin: redisson/redisson

@Override
public ByteBuf setLong(int index, long value) {
  unwrap().setLong(index, value);
  return this;
}

代码示例来源:origin: redisson/redisson

@Override
protected void _setLong(int index, long value) {
  unwrap().setLong(index, value);
}

代码示例来源:origin: wildfly/wildfly

@Override
public ByteBuf setLong(int index, long value) {
  buf.setLong(index, ByteBufUtil.swapLong(value));
  return this;
}

代码示例来源:origin: netty/netty

@Override
protected void _setLong(int index, long value) {
  unwrap().setLong(idx(index), value);
}

代码示例来源:origin: redisson/redisson

@Override
protected void _setLong(int index, long value) {
  unwrap().setLong(idx(index), value);
}

代码示例来源:origin: netty/netty

@Override
public ByteBuf setLong(int index, long value) {
  checkIndex0(index, 8);
  unwrap().setLong(idx(index), value);
  return this;
}

代码示例来源:origin: netty/netty

private ChannelFuture finishEncode(final ChannelHandlerContext ctx, ChannelPromise promise) {
  if (finished) {
    promise.setSuccess();
    return promise;
  }
  finished = true;
  final ByteBuf footer = ctx.alloc().heapBuffer(
      compressor.maxCompressedLength(buffer.readableBytes()) + HEADER_LENGTH);
  flushBufferedData(footer);
  final int idx = footer.writerIndex();
  footer.setLong(idx, MAGIC_NUMBER);
  footer.setByte(idx + TOKEN_OFFSET, (byte) (BLOCK_TYPE_NON_COMPRESSED | compressionLevel));
  footer.setInt(idx + COMPRESSED_LENGTH_OFFSET, 0);
  footer.setInt(idx + DECOMPRESSED_LENGTH_OFFSET, 0);
  footer.setInt(idx + CHECKSUM_OFFSET, 0);
  footer.writerIndex(idx + HEADER_LENGTH);
  return ctx.writeAndFlush(footer, promise);
}

代码示例来源:origin: redisson/redisson

@Override
public ByteBuf setLong(int index, long value) {
  checkIndex0(index, 8);
  unwrap().setLong(idx(index), value);
  return this;
}

代码示例来源:origin: redisson/redisson

private ChannelFuture finishEncode(final ChannelHandlerContext ctx, ChannelPromise promise) {
  if (finished) {
    promise.setSuccess();
    return promise;
  }
  finished = true;
  final ByteBuf footer = ctx.alloc().heapBuffer(
      compressor.maxCompressedLength(buffer.readableBytes()) + HEADER_LENGTH);
  flushBufferedData(footer);
  final int idx = footer.writerIndex();
  footer.setLong(idx, MAGIC_NUMBER);
  footer.setByte(idx + TOKEN_OFFSET, (byte) (BLOCK_TYPE_NON_COMPRESSED | compressionLevel));
  footer.setInt(idx + COMPRESSED_LENGTH_OFFSET, 0);
  footer.setInt(idx + DECOMPRESSED_LENGTH_OFFSET, 0);
  footer.setInt(idx + CHECKSUM_OFFSET, 0);
  footer.writerIndex(idx + HEADER_LENGTH);
  return ctx.writeAndFlush(footer, promise);
}

代码示例来源:origin: netty/netty

@Override
protected void _setLong(int index, long value) {
  Component c = findComponent0(index);
  if (index + 8 <= c.endOffset) {
    c.buf.setLong(c.idx(index), value);
  } else if (order() == ByteOrder.BIG_ENDIAN) {
    _setInt(index, (int) (value >>> 32));
    _setInt(index + 4, (int) value);
  } else {
    _setInt(index, (int) value);
    _setInt(index + 4, (int) (value >>> 32));
  }
}

代码示例来源:origin: redisson/redisson

@Override
protected void _setLong(int index, long value) {
  Component c = findComponent0(index);
  if (index + 8 <= c.endOffset) {
    c.buf.setLong(c.idx(index), value);
  } else if (order() == ByteOrder.BIG_ENDIAN) {
    _setInt(index, (int) (value >>> 32));
    _setInt(index + 4, (int) value);
  } else {
    _setInt(index, (int) value);
    _setInt(index + 4, (int) (value >>> 32));
  }
}

相关文章

ByteBuf类方法