本文整理了Java中io.netty.buffer.ByteBuf.getUnsignedShortLE()
方法的一些代码示例,展示了ByteBuf.getUnsignedShortLE()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ByteBuf.getUnsignedShortLE()
方法的具体详情如下:
包路径:io.netty.buffer.ByteBuf
类名称:ByteBuf
方法名:getUnsignedShortLE
[英]Gets an unsigned 16-bit short integer at the specified absolute index in this buffer in Little Endian Byte Order. This method does not modify readerIndex or writerIndex of this buffer.
[中]获取此缓冲区中指定绝对索引处的无符号16位短整数(以小尾数字节顺序)。此方法不修改此缓冲区的readerIndex或writerIndex。
代码示例来源:origin: netty/netty
@Override
public int getUnsignedShortLE(int index) {
return buf.getUnsignedShortLE(index);
}
代码示例来源:origin: redisson/redisson
@Override
public int getUnsignedShortLE(int index) {
return buf.getUnsignedShortLE(index);
}
代码示例来源:origin: eclipse-vertx/vert.x
public int getUnsignedShortLE(int pos) {
return buffer.getUnsignedShortLE(pos);
}
代码示例来源:origin: wildfly/wildfly
@Override
public int getUnsignedShortLE(int index) {
return buf.getUnsignedShortLE(index);
}
代码示例来源:origin: micronaut-projects/micronaut-core
@Override
public int getUnsignedShortLE(int index) {
return byteBuf.getUnsignedShortLE(index);
}
代码示例来源:origin: netty/netty
@Override
public int getUnsignedShortLE(int index) {
checkIndex(index, 2);
return buffer.getUnsignedShortLE(index);
}
代码示例来源:origin: redisson/redisson
@Override
public int getUnsignedShortLE(int index) {
checkIndex(index, 2);
return buffer.getUnsignedShortLE(index);
}
代码示例来源:origin: wildfly/wildfly
@Override
public int getUnsignedShortLE(int index) {
checkIndex(index, 2);
return buffer.getUnsignedShortLE(index);
}
代码示例来源:origin: traccar/traccar
@Override
protected Object decode(
ChannelHandlerContext ctx, Channel channel, ByteBuf buf) throws Exception {
if (buf.readableBytes() < MESSAGE_MINIMUM_LENGTH) {
return null;
}
int length = buf.getUnsignedShortLE(buf.readerIndex() + 1) & 0x7fff;
if (buf.readableBytes() >= (length + MESSAGE_MINIMUM_LENGTH)) {
return buf.readRetainedSlice(length + MESSAGE_MINIMUM_LENGTH);
}
return null;
}
代码示例来源:origin: redisson/redisson
@SuppressWarnings("deprecation")
private static int unsignedShortBE(ByteBuf buffer, int offset) {
return buffer.order() == ByteOrder.BIG_ENDIAN ?
buffer.getUnsignedShort(offset) : buffer.getUnsignedShortLE(offset);
}
代码示例来源:origin: traccar/traccar
private int messageLength(ByteBuf buf) {
switch (buf.getUnsignedByte(buf.readerIndex())) {
case RoboTrackProtocolDecoder.MSG_ID:
return 69;
case RoboTrackProtocolDecoder.MSG_ACK:
return 3;
case RoboTrackProtocolDecoder.MSG_GPS:
case RoboTrackProtocolDecoder.MSG_GSM:
case RoboTrackProtocolDecoder.MSG_IMAGE_START:
return 24;
case RoboTrackProtocolDecoder.MSG_IMAGE_DATA:
return 8 + buf.getUnsignedShortLE(buf.readerIndex() + 1);
case RoboTrackProtocolDecoder.MSG_IMAGE_END:
return 6;
default:
return Integer.MAX_VALUE;
}
}
代码示例来源:origin: traccar/traccar
@Override
protected Object decode(
ChannelHandlerContext ctx, Channel channel, ByteBuf buf) throws Exception {
if (buf.readableBytes() < 10) {
return null;
}
int headerLength = buf.getUnsignedByte(buf.readerIndex() + 3);
int frameLength = buf.getUnsignedShortLE(buf.readerIndex() + 5);
int length = headerLength + frameLength + (frameLength > 0 ? 2 : 0);
if (buf.readableBytes() >= length) {
return buf.readRetainedSlice(length);
}
return null;
}
代码示例来源:origin: traccar/traccar
@Override
protected Object decode(
ChannelHandlerContext ctx, Channel channel, ByteBuf buf) throws Exception {
if (header && buf.readableBytes() >= HANDSHAKE_LENGTH) {
buf.skipBytes(HANDSHAKE_LENGTH);
header = false;
}
int end = 8; // IMEI
while (buf.readableBytes() >= end + 2 + 1 + 1 + 1) {
end += buf.getUnsignedShortLE(buf.readerIndex() + end) + 2;
if (buf.readableBytes() > end && checksum(buf, end) == buf.getByte(buf.readerIndex() + end)) {
return buf.readRetainedSlice(end + 1);
}
}
return null;
}
代码示例来源:origin: wildfly/wildfly
@SuppressWarnings("deprecation")
private static int unsignedShortBE(ByteBuf buffer, int offset) {
return buffer.order() == ByteOrder.BIG_ENDIAN ?
buffer.getUnsignedShort(offset) : buffer.getUnsignedShortLE(offset);
}
代码示例来源:origin: traccar/traccar
@Override
protected Object decode(ChannelHandlerContext ctx, Channel channel, ByteBuf buf) throws Exception {
if (buf.readableBytes() < 20) {
return null;
}
int length;
if (buf.getUnsignedByte(buf.readerIndex()) == 0x80) {
length = buf.getUnsignedShortLE(buf.readerIndex() + 6);
} else {
length = buf.getUnsignedShort(buf.readerIndex() + 6);
}
if (length >= buf.readableBytes()) {
return buf.readRetainedSlice(length);
}
return null;
}
代码示例来源:origin: traccar/traccar
@Override
protected Object decode(
ChannelHandlerContext ctx, Channel channel, ByteBuf buf) throws Exception {
int indexEnd = BufferUtil.indexOf("\r\n", buf);
if (indexEnd != -1) {
int indexTilde = buf.indexOf(buf.readerIndex(), buf.writerIndex(), (byte) '~');
if (indexTilde != -1 && indexTilde < indexEnd) {
int length = buf.getUnsignedShortLE(indexTilde + 1);
indexEnd = BufferUtil.indexOf("\r\n", buf, indexTilde + 2 + length, buf.writerIndex());
if (indexEnd == -1) {
return null;
}
}
ByteBuf frame = buf.readRetainedSlice(indexEnd - buf.readerIndex());
buf.skipBytes(2);
return frame;
}
return null;
}
代码示例来源:origin: traccar/traccar
@Override
protected Object decode(
ChannelHandlerContext ctx, Channel channel, ByteBuf buf) throws Exception {
// Check minimum length
if (buf.readableBytes() < MESSAGE_HEADER) {
return null;
}
// Check for preamble
boolean hasPreamble = false;
if (buf.getUnsignedIntLE(buf.readerIndex()) == PREAMBLE) {
hasPreamble = true;
}
// Check length and return buffer
int length = buf.getUnsignedShortLE(buf.readerIndex() + 6);
if (buf.readableBytes() >= length) {
if (hasPreamble) {
buf.readUnsignedIntLE();
length -= 4;
}
return buf.readRetainedSlice(length);
}
return null;
}
代码示例来源:origin: traccar/traccar
length += buf.getUnsignedShortLE(buf.readerIndex() + 8);
if (buf.readableBytes() >= length) {
return buf.readRetainedSlice(length);
代码示例来源:origin: traccar/traccar
&& buf.toString(buf.readerIndex() + BINARY_HEADER, 4, StandardCharsets.US_ASCII).equals("$PHD")) {
int length = buf.getUnsignedShortLE(buf.readerIndex() + 3);
if (buf.readableBytes() >= length) {
buf.skipBytes(BINARY_HEADER);
代码示例来源:origin: traccar/traccar
case CellocatorProtocolDecoder.MSG_CLIENT_SERIAL:
if (buf.readableBytes() >= 19) {
length = 19 + buf.getUnsignedShortLE(16);
内容来源于网络,如有侵权,请联系作者删除!