本文整理了Java中io.netty.buffer.ByteBuf.setInt()
方法的一些代码示例,展示了ByteBuf.setInt()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ByteBuf.setInt()
方法的具体详情如下:
包路径: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: netty/netty
@Override
public ByteBuf setIntLE(int index, int value) {
buf.setInt(index, value);
return this;
}
代码示例来源:origin: netty/netty
@Override
public ByteBuf setInt(int index, int value) {
buf.setInt(index, value);
return this;
}
代码示例来源:origin: redisson/redisson
@Override
public ByteBuf setInt(int index, int value) {
buf.setInt(index, value);
return this;
}
代码示例来源:origin: redisson/redisson
@Override
public ByteBuf setIntLE(int index, int value) {
buf.setInt(index, value);
return this;
}
代码示例来源:origin: netty/netty
@Override
public ByteBuf setInt(int index, int value) {
buf.setInt(index, ByteBufUtil.swapInt(value));
return this;
}
代码示例来源:origin: netty/netty
@Override
public ByteBuf setInt(int index, int value) {
unwrap().setInt(index, value);
return this;
}
代码示例来源:origin: netty/netty
@Override
protected void _setInt(int index, int value) {
unwrap().setInt(index, value);
}
代码示例来源:origin: eclipse-vertx/vert.x
public Buffer setUnsignedInt(int pos, long i) {
ensureWritable(pos, 4);
buffer.setInt(pos, (int) i);
return this;
}
代码示例来源:origin: eclipse-vertx/vert.x
public Buffer setInt(int pos, int i) {
ensureWritable(pos, 4);
buffer.setInt(pos, i);
return this;
}
代码示例来源:origin: redisson/redisson
@Override
public ByteBuf setInt(int index, int value) {
unwrap().setInt(index, value);
return this;
}
代码示例来源:origin: redisson/redisson
@Override
public ByteBuf setInt(int index, int value) {
buf.setInt(index, ByteBufUtil.swapInt(value));
return this;
}
代码示例来源:origin: netty/netty
private ChannelFuture finishEncode(final ChannelHandlerContext ctx, ChannelPromise promise) {
if (finished) {
promise.setSuccess();
return promise;
}
finished = true;
final ByteBuf footer = ctx.alloc().heapBuffer(
compressor.maxCompressedLength(buffer.readableBytes()) + HEADER_LENGTH);
flushBufferedData(footer);
final int idx = footer.writerIndex();
footer.setLong(idx, MAGIC_NUMBER);
footer.setByte(idx + TOKEN_OFFSET, (byte) (BLOCK_TYPE_NON_COMPRESSED | compressionLevel));
footer.setInt(idx + COMPRESSED_LENGTH_OFFSET, 0);
footer.setInt(idx + DECOMPRESSED_LENGTH_OFFSET, 0);
footer.setInt(idx + CHECKSUM_OFFSET, 0);
footer.writerIndex(idx + HEADER_LENGTH);
return ctx.writeAndFlush(footer, promise);
}
代码示例来源:origin: netty/netty
@Override
protected void _setInt(int index, int value) {
unwrap().setInt(idx(index), value);
}
代码示例来源:origin: redisson/redisson
@Override
protected void _setInt(int index, int value) {
unwrap().setInt(idx(index), value);
}
代码示例来源:origin: netty/netty
@Override
public ByteBuf setInt(int index, int value) {
checkIndex0(index, 4);
unwrap().setInt(idx(index), value);
return this;
}
代码示例来源:origin: netty/netty
@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: redisson/redisson
@Override
public ByteBuf setInt(int index, int value) {
checkIndex0(index, 4);
unwrap().setInt(idx(index), value);
return this;
}
代码示例来源:origin: redisson/redisson
@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: netty/netty
@Override
protected void _setInt(int index, int value) {
Component c = findComponent0(index);
if (index + 4 <= c.endOffset) {
c.buf.setInt(c.idx(index), 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: redisson/redisson
@Override
protected void _setInt(int index, int value) {
Component c = findComponent0(index);
if (index + 4 <= c.endOffset) {
c.buf.setInt(c.idx(index), 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));
}
}
内容来源于网络,如有侵权,请联系作者删除!