com.couchbase.client.deps.io.netty.buffer.ByteBuf.writeLong()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(166)

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

ByteBuf.writeLong介绍

[英]Sets the specified 64-bit long integer at the current writerIndex and increases the writerIndex by 8in this buffer.
[中]在当前writerIndex处设置指定的64位长整数,并在此缓冲区中将writerIndex增加8。

代码示例

代码示例来源:origin: com.couchbase.client/core-io

@Override
public ByteBuf writeLong(long value) {
  buf.writeLong(value);
  return this;
}

代码示例来源:origin: couchbase/couchbase-jvm-core

@Override
public ByteBuf writeLong(long value) {
  buf.writeLong(value);
  return this;
}

代码示例来源:origin: com.couchbase.client/core-io

@Override
public void writeLong(long v) throws IOException {
  buffer.writeLong(v);
}

代码示例来源:origin: couchbase/couchbase-jvm-core

@Override
public void writeLong(long v) throws IOException {
  buffer.writeLong(v);
}

代码示例来源:origin: com.couchbase.client/core-io

@Override
public ByteBuf writeLong(long value) {
  buf.writeLong(ByteBufUtil.swapLong(value));
  return this;
}

代码示例来源:origin: com.couchbase.client/core-io

/**
 * Creates a new 8-byte big-endian buffer that holds the specified 64-bit integer.
 */
public static ByteBuf copyLong(long value) {
  ByteBuf buf = buffer(8);
  buf.writeLong(value);
  return buf;
}

代码示例来源:origin: couchbase/couchbase-jvm-core

/**
 * Create a new big-endian buffer that holds a sequence of the specified 64-bit integers.
 */
public static ByteBuf copyLong(long... values) {
  if (values == null || values.length == 0) {
    return EMPTY_BUFFER;
  }
  ByteBuf buffer = buffer(values.length * 8);
  for (long v: values) {
    buffer.writeLong(v);
  }
  return buffer;
}

代码示例来源:origin: couchbase/couchbase-jvm-core

/**
 * Creates a new 8-byte big-endian buffer that holds the specified 64-bit integer.
 */
public static ByteBuf copyLong(long value) {
  ByteBuf buf = buffer(8);
  buf.writeLong(value);
  return buf;
}

代码示例来源:origin: couchbase/couchbase-jvm-core

@Override
public ByteBuf writeLong(long value) {
  buf.writeLong(ByteBufUtil.swapLong(value));
  return this;
}

代码示例来源:origin: com.couchbase.client/core-io

/**
 * Create a new big-endian buffer that holds a sequence of the specified 64-bit integers.
 */
public static ByteBuf copyLong(long... values) {
  if (values == null || values.length == 0) {
    return EMPTY_BUFFER;
  }
  ByteBuf buffer = buffer(values.length * 8);
  for (long v: values) {
    buffer.writeLong(v);
  }
  return buffer;
}

代码示例来源:origin: couchbase/java-dcp-client

/**
 * Initialize the buffer with all the values needed.
 *
 * Initializes the complete extras needed with 0 and can be overridden through the setters available.
 * If no setters are used this message is effectively a backfill for the given vbucket.
 */
public static void init(final ByteBuf buffer, short vbucket) {
  MessageUtil.initRequest(DCP_STREAM_REQUEST_OPCODE, buffer);
  MessageUtil.setVbucket(vbucket, buffer);
  MessageUtil.setExtras(Unpooled
          .buffer(48)
          .writeInt(0) // flags
          .writeInt(0) // reserved
          .writeLong(0) // start sequence number
          .writeLong(0) // end sequence number
          .writeLong(0) // vbucket uuid
          .writeLong(0) // snapshot start sequence number
          .writeLong(0), // snapshot end sequence number
      buffer
  );
}

代码示例来源:origin: couchbase/java-dcp-client

public static void init(ByteBuf buffer, short vbid, long seqno) {
  buffer.writeByte(MessageUtil.MAGIC_INT);
  buffer.writeByte(MessageUtil.INTERNAL_ROLLBACK_OPCODE);
  buffer.writeShort(vbid);
  buffer.writeLong(seqno);
}

代码示例来源:origin: couchbase/java-dcp-client

@Override
  public DcpRequestBuilder call() throws Exception {
    return request(MessageUtil.OBSERVE_SEQNO_OPCODE)
        .vbucket(partition)
        .content(Unpooled.buffer(8).writeLong(vbuuid));
  }
}, new Func1<ByteBuf, ObserveSeqnoResponse>() {

代码示例来源:origin: com.couchbase.client/core-io

private static BinaryMemcacheRequest handleObserveSeqnoRequest(final ChannelHandlerContext ctx,
  final ObserveSeqnoRequest msg) {
  ByteBuf content = ctx.alloc().buffer();
  content.writeLong(msg.vbucketUUID());
  BinaryMemcacheRequest request = new DefaultFullBinaryMemcacheRequest(EMPTY_BYTES, Unpooled.EMPTY_BUFFER, content);
  request.setOpcode(OP_OBSERVE_SEQ);
  request.setTotalBodyLength(content.readableBytes());
  return request;
}

代码示例来源:origin: couchbase/couchbase-jvm-core

private static BinaryMemcacheRequest handleObserveSeqnoRequest(final ChannelHandlerContext ctx,
  final ObserveSeqnoRequest msg) {
  ByteBuf content = ctx.alloc().buffer();
  content.writeLong(msg.vbucketUUID());
  BinaryMemcacheRequest request = new DefaultFullBinaryMemcacheRequest(EMPTY_BYTES, Unpooled.EMPTY_BUFFER, content);
  request.setOpcode(OP_OBSERVE_SEQ);
  request.setTotalBodyLength(content.readableBytes());
  return request;
}

代码示例来源:origin: com.couchbase.client/core-io

/**
 * Encodes a {@link CounterRequest} into its lower level representation.
 *
 * Depending on if the {@link CounterRequest#delta} is positive or negative, either the incr or decr memcached
 * commands are utilized. The value is converted to its absolute variant to conform with the protocol.
 *
 * @return a ready {@link BinaryMemcacheRequest}.
 */
private static BinaryMemcacheRequest handleCounterRequest(final ChannelHandlerContext ctx,
  final CounterRequest msg) {
  ByteBuf extras = ctx.alloc().buffer();
  extras.writeLong(Math.abs(msg.delta()));
  extras.writeLong(msg.initial());
  extras.writeInt(msg.expiry());
  byte[] key = msg.keyBytes();
  short keyLength = (short) key.length;
  byte extrasLength = (byte) extras.readableBytes();
  BinaryMemcacheRequest request = new DefaultBinaryMemcacheRequest(key, extras);
  request.setOpcode(msg.delta() < 0 ? OP_COUNTER_DECR : OP_COUNTER_INCR);
  request.setKeyLength(keyLength);
  request.setTotalBodyLength(keyLength + extrasLength);
  request.setExtrasLength(extrasLength);
  return request;
}

代码示例来源:origin: com.couchbase.client/core-io

@Override
protected void encodeHeader(ByteBuf buf, BinaryMemcacheResponse msg) {
  buf.writeByte(msg.getMagic());
  buf.writeByte(msg.getOpcode());
  buf.writeShort(msg.getKeyLength());
  buf.writeByte(msg.getExtrasLength());
  buf.writeByte(msg.getDataType());
  buf.writeShort(msg.getStatus());
  buf.writeInt(msg.getTotalBodyLength());
  buf.writeInt(msg.getOpaque());
  buf.writeLong(msg.getCAS());
}

代码示例来源:origin: com.couchbase.client/core-io

@Override
protected void encodeHeader(ByteBuf buf, BinaryMemcacheRequest msg) {
  buf.writeByte(msg.getMagic());
  buf.writeByte(msg.getOpcode());
  buf.writeShort(msg.getKeyLength());
  buf.writeByte(msg.getExtrasLength());
  buf.writeByte(msg.getDataType());
  buf.writeShort(msg.getReserved());
  buf.writeInt(msg.getTotalBodyLength());
  buf.writeInt(msg.getOpaque());
  buf.writeLong(msg.getCAS());
}

代码示例来源:origin: couchbase/couchbase-jvm-core

@Override
protected void encodeHeader(ByteBuf buf, BinaryMemcacheResponse msg) {
  buf.writeByte(msg.getMagic());
  buf.writeByte(msg.getOpcode());
  buf.writeShort(msg.getKeyLength());
  buf.writeByte(msg.getExtrasLength());
  buf.writeByte(msg.getDataType());
  buf.writeShort(msg.getStatus());
  buf.writeInt(msg.getTotalBodyLength());
  buf.writeInt(msg.getOpaque());
  buf.writeLong(msg.getCAS());
}

代码示例来源:origin: couchbase/couchbase-jvm-core

@Override
protected void encodeHeader(ByteBuf buf, BinaryMemcacheRequest msg) {
  buf.writeByte(msg.getMagic());
  buf.writeByte(msg.getOpcode());
  buf.writeShort(msg.getKeyLength());
  buf.writeByte(msg.getExtrasLength());
  buf.writeByte(msg.getDataType());
  buf.writeShort(msg.getReserved());
  buf.writeInt(msg.getTotalBodyLength());
  buf.writeInt(msg.getOpaque());
  buf.writeLong(msg.getCAS());
}

相关文章