本文整理了Java中com.couchbase.client.deps.io.netty.buffer.ByteBuf.setShort()
方法的一些代码示例,展示了ByteBuf.setShort()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ByteBuf.setShort()
方法的具体详情如下:
包路径:com.couchbase.client.deps.io.netty.buffer.ByteBuf
类名称:ByteBuf
方法名:setShort
[英]Sets the specified 16-bit short integer at the specified absolute index in this buffer. The 16 high-order bits of the specified value are ignored. This method does not modify readerIndex or writerIndex of this buffer.
[中]在此缓冲区中指定的绝对索引处设置指定的16位短整数。指定值的16个高位将被忽略。此方法不修改此缓冲区的readerIndex或writerIndex。
代码示例来源:origin: com.couchbase.client/core-io
@Override
public ByteBuf setShort(int index, int value) {
buf.setShort(index, value);
return this;
}
代码示例来源:origin: couchbase/couchbase-jvm-core
@Override
public ByteBuf setShort(int index, int value) {
buf.setShort(index, value);
return this;
}
代码示例来源:origin: couchbase/java-dcp-client
public static void setVbucket(short vbucket, ByteBuf buffer) {
buffer.setShort(VBUCKET_OFFSET, vbucket);
}
代码示例来源:origin: com.couchbase.client/core-io
@Override
public ByteBuf setShort(int index, int value) {
buf.setShort(index, ByteBufUtil.swapShort((short) value));
return this;
}
代码示例来源:origin: com.couchbase.client/core-io
@Override
public ByteBuf setShort(int index, int value) {
unwrap().setShort(index, value);
return this;
}
代码示例来源:origin: couchbase/couchbase-jvm-core
@Override
public ByteBuf setShort(int index, int value) {
buf.setShort(index, ByteBufUtil.swapShort((short) value));
return this;
}
代码示例来源:origin: couchbase/couchbase-jvm-core
@Override
public ByteBuf setShort(int index, int value) {
unwrap().setShort(index, value);
return this;
}
代码示例来源:origin: com.couchbase.client/core-io
@Override
protected void _setShort(int index, int value) {
unwrap().setShort(index, value);
}
代码示例来源:origin: couchbase/couchbase-jvm-core
@Override
protected void _setShort(int index, int value) {
unwrap().setShort(index, value);
}
代码示例来源:origin: com.couchbase.client/core-io
@Override
protected void _setShort(int index, int value) {
unwrap().setShort(idx(index), value);
}
代码示例来源:origin: couchbase/couchbase-jvm-core
@Override
protected void _setShort(int index, int value) {
unwrap().setShort(idx(index), value);
}
代码示例来源:origin: com.couchbase.client/core-io
@Override
public ByteBuf setShort(int index, int value) {
checkIndex0(index, 2);
unwrap().setShort(idx(index), value);
return this;
}
代码示例来源:origin: couchbase/couchbase-jvm-core
@Override
public ByteBuf setShort(int index, int value) {
checkIndex0(index, 2);
unwrap().setShort(idx(index), value);
return this;
}
代码示例来源:origin: com.couchbase.client/core-io
throw new IllegalArgumentException("not encoded in Base64");
dest.setShort(destOffset, decodedValue);
return 2;
代码示例来源:origin: couchbase/couchbase-jvm-core
throw new IllegalArgumentException("not encoded in Base64");
dest.setShort(destOffset, decodedValue);
return 2;
代码示例来源:origin: couchbase/couchbase-jvm-core
@Override
protected void _setShort(int index, int value) {
Component c = findComponent(index);
if (index + 2 <= c.endOffset) {
c.buf.setShort(index - c.offset, value);
} else if (order() == ByteOrder.BIG_ENDIAN) {
_setByte(index, (byte) (value >>> 8));
_setByte(index + 1, (byte) value);
} else {
_setByte(index, (byte) value);
_setByte(index + 1, (byte) (value >>> 8));
}
}
代码示例来源:origin: com.couchbase.client/core-io
@Override
protected void _setShort(int index, int value) {
Component c = findComponent(index);
if (index + 2 <= c.endOffset) {
c.buf.setShort(index - c.offset, value);
} else if (order() == ByteOrder.BIG_ENDIAN) {
_setByte(index, (byte) (value >>> 8));
_setByte(index + 1, (byte) value);
} else {
_setByte(index, (byte) value);
_setByte(index + 1, (byte) (value >>> 8));
}
}
代码示例来源:origin: couchbase/java-dcp-client
/**
* Helper method to set the key, update the key length and the content length.
*/
public static void setKey(ByteBuf key, ByteBuf buffer) {
short oldKeyLength = buffer.getShort(KEY_LENGTH_OFFSET);
short newKeyLength = (short) key.readableBytes();
int oldBodyLength = buffer.getInt(BODY_LENGTH_OFFSET);
byte extrasLength = buffer.getByte(EXTRAS_LENGTH_OFFSET);
int newBodyLength = oldBodyLength - oldKeyLength + newKeyLength;
buffer.setShort(KEY_LENGTH_OFFSET, newKeyLength);
buffer.setInt(BODY_LENGTH_OFFSET, newBodyLength);
buffer.setBytes(HEADER_SIZE + extrasLength, key);
buffer.writerIndex(HEADER_SIZE + newBodyLength);
// todo: make sure stuff is still in order if content is there and its sliced in
// todo: what if old key with different size is there
}
内容来源于网络,如有侵权,请联系作者删除!