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

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

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

ByteBuf.writeByte介绍

[英]Sets the specified byte at the current writerIndexand increases the writerIndex by 1 in this buffer. The 24 high-order bits of the specified value are ignored.
[中]

代码示例

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

@Override
public ByteBuf writeByte(int value) {
  buf.writeByte(value);
  return this;
}

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

@Override
  public void encodeAsByteBuf(ByteBuf byteBuf) {
    byteBuf.writeByte(SUBNEGOTIATION_VERSION.byteValue());
    byteBuf.writeByte(username.length());
    byteBuf.writeBytes(username.getBytes(CharsetUtil.US_ASCII));
    byteBuf.writeByte(password.length());
    byteBuf.writeBytes(password.getBytes(CharsetUtil.US_ASCII));
  }
}

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

@Override
  public void encodeAsByteBuf(ByteBuf byteBuf) {
    byteBuf.writeByte(SUBNEGOTIATION_VERSION.byteValue());
    byteBuf.writeByte(username.length());
    byteBuf.writeBytes(username.getBytes(CharsetUtil.US_ASCII));
    byteBuf.writeByte(password.length());
    byteBuf.writeBytes(password.getBytes(CharsetUtil.US_ASCII));
  }
}

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

@Override
public ByteBuf writeByte(int value) {
  buf.writeByte(value);
  return this;
}

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

private static void writeUnencodedChunk(ByteBuf in, ByteBuf out, int dataLength) {
  out.writeByte(1);
  writeChunkLength(out, dataLength + 4);
  calculateAndWriteChecksum(in, out);
  out.writeBytes(in, dataLength);
}

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

private static void encodeCopyWithOffset(ByteBuf out, int offset, int length) {
  if (length < 12 && offset < 2048) {
    out.writeByte(COPY_1_BYTE_OFFSET | length - 4 << 2 | offset >> 8 << 5);
    out.writeByte(offset & 0x0ff);
  } else {
    out.writeByte(COPY_2_BYTE_OFFSET | length - 1 << 2);
    out.writeByte(offset & 0x0ff);
    out.writeByte(offset >> 8 & 0x0ff);
  }
}

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

private static void writeUnencodedChunk(ByteBuf in, ByteBuf out, int dataLength) {
  out.writeByte(1);
  writeChunkLength(out, dataLength + 4);
  calculateAndWriteChecksum(in, out);
  out.writeBytes(in, dataLength);
}

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

private static void encodeCopyWithOffset(ByteBuf out, int offset, int length) {
  if (length < 12 && offset < 2048) {
    out.writeByte(COPY_1_BYTE_OFFSET | length - 4 << 2 | offset >> 8 << 5);
    out.writeByte(offset & 0x0ff);
  } else {
    out.writeByte(COPY_2_BYTE_OFFSET | length - 1 << 2);
    out.writeByte(offset & 0x0ff);
    out.writeByte(offset >> 8 & 0x0ff);
  }
}

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

void encode(ByteBuf buf) {
    if (bytes == null) {
      HttpHeaders.encodeAscii0(String.valueOf(code()), buf);
      buf.writeByte(SP);
      HttpHeaders.encodeAscii0(String.valueOf(reasonPhrase()), buf);
    } else {
      buf.writeBytes(bytes);
    }
  }
}

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

@Override
  public void encodeAsByteBuf(ByteBuf byteBuf) {
    byteBuf.writeByte(SUBNEGOTIATION_VERSION.byteValue());
    byteBuf.writeByte(authStatus.byteValue());
  }
}

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

@Override
protected void encodeInitialLine(ByteBuf buf, HttpResponse response) throws Exception {
  response.getProtocolVersion().encode(buf);
  buf.writeByte(SP);
  response.getStatus().encode(buf);
  buf.writeBytes(CRLF);
}

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

static void encodeAscii0(CharSequence seq, ByteBuf buf) {
  int length = seq.length();
  for (int i = 0 ; i < length; i++) {
    buf.writeByte(c2b(seq.charAt(i)));
  }
}

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

public ByteBuf encodeDataFrame(ByteBufAllocator allocator, int streamId, boolean last, ByteBuf data) {
  byte flags = last ? SPDY_DATA_FLAG_FIN : 0;
  int length = data.readableBytes();
  ByteBuf frame = allocator.ioBuffer(SPDY_HEADER_SIZE + length).order(ByteOrder.BIG_ENDIAN);
  frame.writeInt(streamId & 0x7FFFFFFF);
  frame.writeByte(flags);
  frame.writeMedium(length);
  frame.writeBytes(data, data.readerIndex(), length);
  return frame;
}

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

@Override
  public void encodeAsByteBuf(ByteBuf byteBuf) {
    byteBuf.writeByte(protocolVersion().byteValue());
    byteBuf.writeByte(authSchemes.size());
    for (SocksAuthScheme authScheme : authSchemes) {
      byteBuf.writeByte(authScheme.byteValue());
    }
  }
}

代码示例来源: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: com.couchbase.client/core-io

@Override
  public void encodeAsByteBuf(ByteBuf byteBuf) {
    byteBuf.writeByte(protocolVersion().byteValue());
    byteBuf.writeByte(authScheme.byteValue());
  }
}

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

private void writeControlFrameHeader(ByteBuf buffer, int type, byte flags, int length) {
  buffer.writeShort(version | 0x8000);
  buffer.writeShort(type);
  buffer.writeByte(flags);
  buffer.writeMedium(length);
}

代码示例来源: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: 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());
}

代码示例来源: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());
}

相关文章