本文整理了Java中io.netty.buffer.ByteBuf.writeShortLE()
方法的一些代码示例,展示了ByteBuf.writeShortLE()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ByteBuf.writeShortLE()
方法的具体详情如下:
包路径:io.netty.buffer.ByteBuf
类名称:ByteBuf
方法名:writeShortLE
[英]Sets the specified 16-bit short integer in the Little Endian Byte Order at the current writerIndex and increases the writerIndex by 2 in this buffer. The 16 high-order bits of the specified value are ignored.
[中]在当前writerIndex处以小尾端字节顺序设置指定的16位短整数,并在此缓冲区中将writerIndex增加2。指定值的16个高位将被忽略。
代码示例来源:origin: netty/netty
@Override
public ByteBuf writeShortLE(int value) {
buf.writeShortLE(value);
return this;
}
代码示例来源:origin: redisson/redisson
@Override
public ByteBuf writeShortLE(int value) {
buf.writeShortLE(value);
return this;
}
代码示例来源:origin: eclipse-vertx/vert.x
public Buffer appendUnsignedShortLE(int s) {
buffer.writeShortLE(s);
return this;
}
代码示例来源:origin: eclipse-vertx/vert.x
public Buffer appendShortLE(short s) {
buffer.writeShortLE(s);
return this;
}
代码示例来源:origin: apache/incubator-shardingsphere
/**
* Write 2 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 2 byte fixed length integer
*/
public void writeInt2(final int value) {
byteBuf.writeShortLE(value);
}
代码示例来源:origin: apache/incubator-shardingsphere
/**
* Write 2 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 2 byte fixed length integer
*/
public void writeInt2(final int value) {
byteBuf.writeShortLE(value);
}
代码示例来源:origin: wildfly/wildfly
@Override
public ByteBuf writeShortLE(int value) {
buf.writeShortLE(value);
return this;
}
代码示例来源:origin: micronaut-projects/micronaut-core
@Override
public ByteBuf writeShortLE(int value) {
byteBuf.writeShortLE(value);
return this;
}
代码示例来源:origin: netty/netty
/**
* Writes a big-endian 16-bit short integer to the buffer.
*/
@SuppressWarnings("deprecation")
public static ByteBuf writeShortBE(ByteBuf buf, int shortValue) {
return buf.order() == ByteOrder.BIG_ENDIAN? buf.writeShort(shortValue) : buf.writeShortLE(shortValue);
}
代码示例来源:origin: redisson/redisson
/**
* Writes a big-endian 16-bit short integer to the buffer.
*/
@SuppressWarnings("deprecation")
public static ByteBuf writeShortBE(ByteBuf buf, int shortValue) {
return buf.order() == ByteOrder.BIG_ENDIAN? buf.writeShort(shortValue) : buf.writeShortLE(shortValue);
}
代码示例来源:origin: traccar/traccar
private static void sendResponseArchive(Channel channel, int deviceId, int packNum) {
ByteBuf response = Unpooled.buffer();
response.writeBytes("BB+ARCF~".getBytes(StandardCharsets.US_ASCII));
response.writeShortLE(4); // length
response.writeShortLE(packNum);
response.writeShortLE(deviceId);
appendChecksum(response, 14);
channel.writeAndFlush(new NetworkMessage(response, channel.remoteAddress()));
}
代码示例来源:origin: wildfly/wildfly
/**
* Writes a big-endian 16-bit short integer to the buffer.
*/
@SuppressWarnings("deprecation")
public static ByteBuf writeShortBE(ByteBuf buf, int shortValue) {
return buf.order() == ByteOrder.BIG_ENDIAN? buf.writeShort(shortValue) : buf.writeShortLE(shortValue);
}
代码示例来源:origin: traccar/traccar
private void sendReply(Channel channel, int header, int checksum) {
if (channel != null) {
ByteBuf reply = Unpooled.buffer(3);
reply.writeByte(header);
reply.writeShortLE((short) checksum);
channel.writeAndFlush(new NetworkMessage(reply, channel.remoteAddress()));
}
}
代码示例来源:origin: traccar/traccar
private static void sendResponseCurrent(Channel channel, int deviceId, long time) {
ByteBuf response = Unpooled.buffer();
response.writeBytes("BB+UGRC~".getBytes(StandardCharsets.US_ASCII));
response.writeShortLE(6); // length
response.writeInt((int) time);
response.writeShortLE(deviceId);
appendChecksum(response, 16);
channel.writeAndFlush(new NetworkMessage(response, channel.remoteAddress()));
}
代码示例来源:origin: traccar/traccar
private void sendReply(Channel channel, int checksum) {
if (channel != null) {
ByteBuf reply = Unpooled.buffer(3);
reply.writeByte(0x02);
reply.writeShortLE((short) checksum);
channel.writeAndFlush(new NetworkMessage(reply, channel.remoteAddress()));
}
}
代码示例来源:origin: traccar/traccar
private void sendResponse(Channel channel, int type, ByteBuf content) {
if (channel != null) {
ByteBuf response = Unpooled.buffer();
response.writeByte(0x02); response.writeByte(0x55); // header
response.writeByte(type);
response.writeShortLE(content != null ? content.readableBytes() : 0);
if (content != null) {
response.writeBytes(content);
content.release();
}
channel.writeAndFlush(new NetworkMessage(response, 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 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 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 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()));
}
}
内容来源于网络,如有侵权,请联系作者删除!