本文整理了Java中com.couchbase.client.deps.io.netty.buffer.ByteBuf.setInt()
方法的一些代码示例,展示了ByteBuf.setInt()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ByteBuf.setInt()
方法的具体详情如下:
包路径:com.couchbase.client.deps.io.netty.buffer.ByteBuf
类名称:ByteBuf
方法名:setInt
[英]Sets the specified 32-bit integer at the specified absolute index in this buffer. This method does not modify readerIndex or writerIndex of this buffer.
[中]在此缓冲区中指定的绝对索引处设置指定的32位整数。此方法不修改此缓冲区的readerIndex或writerIndex。
代码示例来源:origin: com.couchbase.client/core-io
@Override
public ByteBuf setInt(int index, int value) {
buf.setInt(index, value);
return this;
}
代码示例来源:origin: couchbase/couchbase-jvm-core
@Override
public ByteBuf setInt(int index, int value) {
buf.setInt(index, value);
return this;
}
代码示例来源:origin: com.couchbase.client/core-io
private static void setLengthField(ByteBuf buffer, int writerIndex, int length) {
buffer.setInt(writerIndex, length);
}
代码示例来源:origin: couchbase/couchbase-jvm-core
@Override
protected void _setInt(int index, int value) {
unwrap().setInt(index, value);
}
代码示例来源:origin: com.couchbase.client/core-io
@Override
public ByteBuf setInt(int index, int value) {
unwrap().setInt(index, value);
return this;
}
代码示例来源:origin: couchbase/couchbase-jvm-core
@Override
public ByteBuf setInt(int index, int value) {
unwrap().setInt(index, value);
return this;
}
代码示例来源:origin: com.couchbase.client/core-io
@Override
public ByteBuf setInt(int index, int value) {
buf.setInt(index, ByteBufUtil.swapInt(value));
return this;
}
代码示例来源:origin: couchbase/couchbase-jvm-core
@Override
public ByteBuf setInt(int index, int value) {
buf.setInt(index, ByteBufUtil.swapInt(value));
return this;
}
代码示例来源:origin: com.couchbase.client/core-io
@Override
protected void _setInt(int index, int value) {
unwrap().setInt(index, value);
}
代码示例来源:origin: couchbase/java-dcp-client
public static void flags(final ByteBuf buffer, int flags) {
MessageUtil.getExtras(buffer).setInt(0, flags);
}
代码示例来源:origin: couchbase/couchbase-jvm-core
@Override
protected void _setInt(int index, int value) {
unwrap().setInt(idx(index), value);
}
代码示例来源:origin: com.couchbase.client/core-io
@Override
protected void _setInt(int index, int value) {
unwrap().setInt(idx(index), value);
}
代码示例来源:origin: com.couchbase.client/core-io
@Override
public ByteBuf setInt(int index, int value) {
checkIndex0(index, 4);
unwrap().setInt(idx(index), value);
return this;
}
代码示例来源:origin: couchbase/couchbase-jvm-core
@Override
public ByteBuf setInt(int index, int value) {
checkIndex0(index, 4);
unwrap().setInt(idx(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: couchbase/couchbase-jvm-core
@Override
protected void _setInt(int index, int value) {
Component c = findComponent(index);
if (index + 4 <= c.endOffset) {
c.buf.setInt(index - c.offset, value);
} else if (order() == ByteOrder.BIG_ENDIAN) {
_setShort(index, (short) (value >>> 16));
_setShort(index + 2, (short) value);
} else {
_setShort(index, (short) value);
_setShort(index + 2, (short) (value >>> 16));
}
}
代码示例来源:origin: com.couchbase.client/core-io
@Override
protected void _setInt(int index, int value) {
Component c = findComponent(index);
if (index + 4 <= c.endOffset) {
c.buf.setInt(index - c.offset, value);
} else if (order() == ByteOrder.BIG_ENDIAN) {
_setShort(index, (short) (value >>> 16));
_setShort(index + 2, (short) value);
} else {
_setShort(index, (short) value);
_setShort(index + 2, (short) (value >>> 16));
}
}
代码示例来源:origin: couchbase/java-dcp-client
/**
* Sets the content payload of the buffer, updating the content length as well.
*/
public static void setContent(ByteBuf content, ByteBuf buffer) {
short keyLength = buffer.getShort(KEY_LENGTH_OFFSET);
byte extrasLength = buffer.getByte(EXTRAS_LENGTH_OFFSET);
int bodyLength = keyLength + extrasLength + content.readableBytes();
int contentOffset = HEADER_SIZE + extrasLength + keyLength;
buffer.setInt(BODY_LENGTH_OFFSET, bodyLength);
buffer.writerIndex(contentOffset);
buffer.ensureWritable(content.readableBytes());
buffer.writeBytes(content);
buffer.writerIndex(HEADER_SIZE + bodyLength);
}
代码示例来源:origin: com.couchbase.client/core-io
@Override
protected void encode(ChannelHandlerContext ctx, Object msg, ByteBuf out) throws Exception {
Marshaller marshaller = provider.getMarshaller(ctx);
int lengthPos = out.writerIndex();
out.writeBytes(LENGTH_PLACEHOLDER);
ChannelBufferByteOutput output = new ChannelBufferByteOutput(out);
marshaller.start(output);
marshaller.writeObject(msg);
marshaller.finish();
marshaller.close();
out.setInt(lengthPos, out.writerIndex() - lengthPos - 4);
}
}
代码示例来源:origin: couchbase/couchbase-jvm-core
@Override
protected void encode(ChannelHandlerContext ctx, Object msg, ByteBuf out) throws Exception {
Marshaller marshaller = provider.getMarshaller(ctx);
int lengthPos = out.writerIndex();
out.writeBytes(LENGTH_PLACEHOLDER);
ChannelBufferByteOutput output = new ChannelBufferByteOutput(out);
marshaller.start(output);
marshaller.writeObject(msg);
marshaller.finish();
marshaller.close();
out.setInt(lengthPos, out.writerIndex() - lengthPos - 4);
}
}
内容来源于网络,如有侵权,请联系作者删除!