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

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

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

ByteBuf.setByte介绍

[英]Sets the specified byte at the specified absolute index in this buffer. The 24 high-order bits of the specified value are ignored. This method does not modify readerIndex or writerIndex of this buffer.
[中]在此缓冲区中指定的绝对索引处设置指定的字节。指定值的24个高位将被忽略。此方法不修改此缓冲区的readerIndex或writerIndex。

代码示例

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

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

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

public static void setExtras(ByteBuf extras, ByteBuf buffer) {
  byte oldExtrasLength = buffer.getByte(EXTRAS_LENGTH_OFFSET);
  byte newExtrasLength = (byte) extras.readableBytes();
  int oldBodyLength = buffer.getInt(BODY_LENGTH_OFFSET);
  int newBodyLength = oldBodyLength - oldExtrasLength + newExtrasLength;
  buffer.setByte(EXTRAS_LENGTH_OFFSET, newExtrasLength);
  buffer.setInt(BODY_LENGTH_OFFSET, newBodyLength);
  buffer.setBytes(HEADER_SIZE, extras);
  buffer.writerIndex(HEADER_SIZE + newBodyLength);
}

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

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

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

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

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

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

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

public static void setDataType(byte dataType, ByteBuf buffer) {
  buffer.setByte(DATA_TYPE_OFFSET, dataType);
}

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

@Override
public CompositeByteBuf setByte(int index, int value) {
  Component c = findComponent(index);
  c.buf.setByte(index - c.offset, value);
  return this;
}

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

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

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

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

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

@Override
public CompositeByteBuf setByte(int index, int value) {
  Component c = findComponent(index);
  c.buf.setByte(index - c.offset, value);
  return this;
}

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

@Override
protected void _setByte(int index, int value) {
  unwrap().setByte(index, value);
}

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

@Override
protected void _setByte(int index, int value) {
  unwrap().setByte(index, value);
}

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

@Override
protected void _setByte(int index, int value) {
  unwrap().setByte(idx(index), value);
}

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

@Override
protected void _setByte(int index, int value) {
  unwrap().setByte(idx(index), value);
}

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

@Override
public ByteBuf setByte(int index, int value) {
  checkIndex0(index, 1);
  unwrap().setByte(idx(index), value);
  return this;
}

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

@Override
public ByteBuf setByte(int index, int value) {
  checkIndex0(index, 1);
  unwrap().setByte(idx(index), value);
  return this;
}

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

private void unmask(ByteBuf frame) {
  int i = frame.readerIndex();
  int end = frame.writerIndex();
  ByteOrder order = frame.order();
  // Remark: & 0xFF is necessary because Java will do signed expansion from
  // byte to int which we don't want.
  int intMask = ((maskingKey[0] & 0xFF) << 24)
        | ((maskingKey[1] & 0xFF) << 16)
        | ((maskingKey[2] & 0xFF) << 8)
        | (maskingKey[3] & 0xFF);
  // If the byte order of our buffers it little endian we have to bring our mask
  // into the same format, because getInt() and writeInt() will use a reversed byte order
  if (order == ByteOrder.LITTLE_ENDIAN) {
    intMask = Integer.reverseBytes(intMask);
  }
  for (; i + 3 < end; i += 4) {
    int unmasked = frame.getInt(i) ^ intMask;
    frame.setInt(i, unmasked);
  }
  for (; i < end; i++) {
    frame.setByte(i, frame.getByte(i) ^ maskingKey[i % 4]);
  }
}

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

private void unmask(ByteBuf frame) {
  int i = frame.readerIndex();
  int end = frame.writerIndex();
  ByteOrder order = frame.order();
  // Remark: & 0xFF is necessary because Java will do signed expansion from
  // byte to int which we don't want.
  int intMask = ((maskingKey[0] & 0xFF) << 24)
        | ((maskingKey[1] & 0xFF) << 16)
        | ((maskingKey[2] & 0xFF) << 8)
        | (maskingKey[3] & 0xFF);
  // If the byte order of our buffers it little endian we have to bring our mask
  // into the same format, because getInt() and writeInt() will use a reversed byte order
  if (order == ByteOrder.LITTLE_ENDIAN) {
    intMask = Integer.reverseBytes(intMask);
  }
  for (; i + 3 < end; i += 4) {
    int unmasked = frame.getInt(i) ^ intMask;
    frame.setInt(i, unmasked);
  }
  for (; i < end; i++) {
    frame.setByte(i, frame.getByte(i) ^ maskingKey[i % 4]);
  }
}

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

dest.setByte(e + 4, NEW_LINE);
e ++;
lineLength = 0;

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

info.setByte(closingPointer, '}');
  viewInfoObservable.onNext(info);
} else {

相关文章