Class ByteBufUtil
java.lang.Object
org.infinispan.hotrod.impl.transport.netty.ByteBufUtil
Helper methods for writing varints, arrays and strings to
ByteBuf.-
Method Summary
Modifier and TypeMethodDescriptionstatic intestimateArraySize(byte[] array) static intestimateVIntSize(int value) static intestimateVLongSize(long value) static intestimateXidSize(Xid xid) Estimates theXidencoding size.static StringlimitedHexDump(io.netty.buffer.ByteBuf buf) static byte[]readArray(io.netty.buffer.ByteBuf buf) static byte[]readMaybeArray(io.netty.buffer.ByteBuf bf) static byte[]readMaybeRangedArray(io.netty.buffer.ByteBuf bf, int length) static intreadMaybeVInt(io.netty.buffer.ByteBuf buf) static StringreadString(io.netty.buffer.ByteBuf bf) static intreadVInt(io.netty.buffer.ByteBuf buf) static longreadVLong(io.netty.buffer.ByteBuf buf) static voidwriteArray(io.netty.buffer.ByteBuf buf, byte[] toAppend) static voidwriteArray(io.netty.buffer.ByteBuf buf, byte[] toAppend, int offset, int count) static voidwriteOptionalArray(io.netty.buffer.ByteBuf buf, byte[] toAppend) static voidwriteOptionalString(io.netty.buffer.ByteBuf buf, String string) static voidwriteSignedVInt(io.netty.buffer.ByteBuf buf, int i) static voidwriteString(io.netty.buffer.ByteBuf buf, String string) static voidwriteVInt(io.netty.buffer.ByteBuf buf, int i) static voidwriteVLong(io.netty.buffer.ByteBuf buf, long i) static voidWrites theXidto theByteBuf.
-
Method Details
-
readArray
public static byte[] readArray(io.netty.buffer.ByteBuf buf) -
readMaybeArray
public static byte[] readMaybeArray(io.netty.buffer.ByteBuf bf) -
readMaybeRangedArray
public static byte[] readMaybeRangedArray(io.netty.buffer.ByteBuf bf, int length) -
readString
-
writeString
-
writeOptionalString
-
writeArray
public static void writeArray(io.netty.buffer.ByteBuf buf, byte[] toAppend) -
writeArray
public static void writeArray(io.netty.buffer.ByteBuf buf, byte[] toAppend, int offset, int count) -
estimateArraySize
public static int estimateArraySize(byte[] array) -
estimateVIntSize
public static int estimateVIntSize(int value) -
writeOptionalArray
public static void writeOptionalArray(io.netty.buffer.ByteBuf buf, byte[] toAppend) -
writeVInt
public static void writeVInt(io.netty.buffer.ByteBuf buf, int i) -
writeSignedVInt
public static void writeSignedVInt(io.netty.buffer.ByteBuf buf, int i) -
writeVLong
public static void writeVLong(io.netty.buffer.ByteBuf buf, long i) -
estimateVLongSize
public static int estimateVLongSize(long value) -
readVLong
public static long readVLong(io.netty.buffer.ByteBuf buf) -
readVInt
public static int readVInt(io.netty.buffer.ByteBuf buf) -
readMaybeVInt
public static int readMaybeVInt(io.netty.buffer.ByteBuf buf) -
limitedHexDump
-
estimateXidSize
Estimates theXidencoding size.If the instance is a
RemoteXid, the estimation is accurate. Otherwise, the max size is used.- Parameters:
xid- theXidinstance to test.- Returns:
- the estimated size.
-
writeXid
Writes theXidto theByteBuf.- Parameters:
buf- the buffer to write to.xid- theXidto encode
-