本文整理了Java中io.netty.buffer.ByteBuf.writeIntLE()
方法的一些代码示例,展示了ByteBuf.writeIntLE()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ByteBuf.writeIntLE()
方法的具体详情如下:
包路径:io.netty.buffer.ByteBuf
类名称:ByteBuf
方法名:writeIntLE
[英]Sets the specified 32-bit integer at the current writerIndexin the Little Endian Byte Order and increases the writerIndexby 4 in this buffer.
[中]在当前WriterIndex处按小尾数字节顺序设置指定的32位整数,并在此缓冲区中将WriterIndex增加4。
代码示例来源:origin: netty/netty
@Override
public ByteBuf writeIntLE(int value) {
buf.writeIntLE(value);
return this;
}
代码示例来源:origin: redisson/redisson
@Override
public ByteBuf writeIntLE(int value) {
buf.writeIntLE(value);
return this;
}
代码示例来源:origin: eclipse-vertx/vert.x
public Buffer appendIntLE(int i) {
buffer.writeIntLE(i);
return this;
}
代码示例来源:origin: eclipse-vertx/vert.x
public Buffer appendUnsignedIntLE(long i) {
buffer.writeIntLE((int) i);
return this;
}
代码示例来源:origin: apache/incubator-shardingsphere
/**
* Write 4 byte fixed length integer to byte buffers.
*
* @see <a href="https://dev.mysql.com/doc/internals/en/integer.html#packet-Protocol::FixedLengthInteger">FixedLengthInteger</a>
*
* @param value 4 byte fixed length integer
*/
public void writeInt4(final int value) {
byteBuf.writeIntLE(value);
}
代码示例来源:origin: apache/incubator-shardingsphere
/**
* Write 4 byte fixed length integer to byte buffers.
*
* @see <a href="https://dev.mysql.com/doc/internals/en/integer.html#packet-Protocol::FixedLengthInteger">FixedLengthInteger</a>
*
* @param value 4 byte fixed length integer
*/
public void writeInt4(final int value) {
byteBuf.writeIntLE(value);
}
代码示例来源:origin: netty/netty
/**
* Sets the specified 32-bit floating point number at the current
* {@code writerIndex} in Little Endian Byte Order and increases
* the {@code writerIndex} by {@code 4} in this buffer.
* If {@code this.writableBytes} is less than {@code 4}, {@link #ensureWritable(int)}
* will be called in an attempt to expand capacity to accommodate.
*/
public ByteBuf writeFloatLE(float value) {
return writeIntLE(Float.floatToRawIntBits(value));
}
代码示例来源:origin: micronaut-projects/micronaut-core
@Override
public ByteBuf writeIntLE(int value) {
byteBuf.writeIntLE(value);
return this;
}
代码示例来源:origin: wildfly/wildfly
@Override
public ByteBuf writeIntLE(int value) {
buf.writeIntLE(value);
return this;
}
代码示例来源:origin: redisson/redisson
/**
* Sets the specified 32-bit floating point number at the current
* {@code writerIndex} in Little Endian Byte Order and increases
* the {@code writerIndex} by {@code 4} in this buffer.
* If {@code this.writableBytes} is less than {@code 4}, {@link #ensureWritable(int)}
* will be called in an attempt to expand capacity to accommodate.
*/
public ByteBuf writeFloatLE(float value) {
return writeIntLE(Float.floatToRawIntBits(value));
}
代码示例来源:origin: netty/netty
/**
* Calculates and writes the 4-byte checksum to the output buffer
*
* @param slice The data to calculate the checksum for
* @param out The output buffer to write the checksum to
*/
private static void calculateAndWriteChecksum(ByteBuf slice, ByteBuf out) {
out.writeIntLE(calculateChecksum(slice));
}
}
代码示例来源:origin: wildfly/wildfly
/**
* Sets the specified 32-bit floating point number at the current
* {@code writerIndex} in Little Endian Byte Order and increases
* the {@code writerIndex} by {@code 4} in this buffer.
*
* @throws IndexOutOfBoundsException
* if {@code this.writableBytes} is less than {@code 4}
*/
public ByteBuf writeFloatLE(float value) {
return writeIntLE(Float.floatToRawIntBits(value));
}
代码示例来源:origin: redisson/redisson
/**
* Calculates and writes the 4-byte checksum to the output buffer
*
* @param slice The data to calculate the checksum for
* @param out The output buffer to write the checksum to
*/
private static void calculateAndWriteChecksum(ByteBuf slice, ByteBuf out) {
out.writeIntLE(calculateChecksum(slice));
}
}
代码示例来源:origin: wildfly/wildfly
/**
* Calculates and writes the 4-byte checksum to the output buffer
*
* @param slice The data to calculate the checksum for
* @param out The output buffer to write the checksum to
*/
private static void calculateAndWriteChecksum(ByteBuf slice, ByteBuf out) {
out.writeIntLE(calculateChecksum(slice));
}
}
代码示例来源:origin: traccar/traccar
private void requestArchive(Channel channel) {
if (lastIndex == 0) {
lastIndex = newIndex;
} else if (newIndex > lastIndex) {
ByteBuf request = Unpooled.buffer(12);
request.writeShortLE(MSG_LOG_SYNC);
request.writeShortLE(4);
request.writeIntLE((int) lastIndex);
request.writeIntLE(0);
channel.writeAndFlush(new NetworkMessage(request, channel.remoteAddress()));
}
}
代码示例来源:origin: traccar/traccar
private void sendReply(Channel channel, ByteBuf data) {
if (channel != null) {
ByteBuf header = Unpooled.buffer(16);
header.writeCharSequence(prefix, StandardCharsets.US_ASCII);
header.writeIntLE((int) deviceUniqueId);
header.writeIntLE((int) serverId);
header.writeShortLE(data.readableBytes());
header.writeByte(checksum(data));
header.writeByte(checksum(header));
channel.writeAndFlush(new NetworkMessage(Unpooled.wrappedBuffer(header, data), channel.remoteAddress()));
}
}
代码示例来源:origin: traccar/traccar
private ByteBuf encodeText(String uniqueId, String text) {
ByteBuf buf = Unpooled.buffer(256);
buf.writeByte(0x01);
buf.writeShortLE(uniqueId.length() + text.length() + 11);
buf.writeByte(0x03); // imei tag
buf.writeBytes(uniqueId.getBytes(StandardCharsets.US_ASCII));
buf.writeByte(0x04); // device id tag
buf.writeShortLE(0); // not needed if imei provided
buf.writeByte(0xE0); // index tag
buf.writeIntLE(0); // index
buf.writeByte(0xE1); // command text tag
buf.writeByte(text.length());
buf.writeBytes(text.getBytes(StandardCharsets.US_ASCII));
buf.writeShortLE(Checksum.crc16(Checksum.CRC16_MODBUS, buf.nioBuffer(0, buf.writerIndex())));
return buf;
}
代码示例来源:origin: traccar/traccar
private void requestArchive(Channel channel) {
if (lastIndex == 0) {
lastIndex = newIndex;
} else if (newIndex > lastIndex) {
ByteBuf request = Unpooled.buffer(14);
request.writeShortLE(MSG_REQUEST_LOG_RECORDS);
request.writeShortLE(6);
request.writeIntLE((int) lastIndex);
request.writeShortLE(512);
request.writeIntLE(Checksum.crc32(request.nioBuffer(0, 10)));
channel.writeAndFlush(new NetworkMessage(request, channel.remoteAddress()));
}
}
代码示例来源:origin: traccar/traccar
private void sendSimpleMessage(Channel channel, short type) {
ByteBuf request = Unpooled.buffer(8);
request.writeShortLE(type);
request.writeShortLE(0);
request.writeIntLE(Checksum.crc32(request.nioBuffer(0, 4)));
channel.writeAndFlush(new NetworkMessage(request, channel.remoteAddress()));
}
代码示例来源:origin: traccar/traccar
private Object processSingle(DeviceSession deviceSession, Channel channel, ByteBuf buf) {
ParseResult result = parsePosition(deviceSession, buf);
ByteBuf response = Unpooled.buffer(8);
response.writeCharSequence("*<T", StandardCharsets.US_ASCII);
response.writeIntLE((int) result.getId());
sendReply(channel, response);
if (result.getPosition().getFixTime() == null) {
return null;
}
return result.getPosition();
}
内容来源于网络,如有侵权,请联系作者删除!