Class ExtendedByteBuf
- java.lang.Object
-
- org.infinispan.server.hotrod.transport.ExtendedByteBuf
-
public class ExtendedByteBuf extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description ExtendedByteBuf()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static io.netty.buffer.ByteBuf
buffer(int capacity)
static io.netty.buffer.ByteBuf
dynamicBuffer()
static java.util.Optional<java.lang.Byte>
readMaybeByte(io.netty.buffer.ByteBuf bf)
Reads a byte if possible.static java.util.Optional<java.lang.Long>
readMaybeLong(io.netty.buffer.ByteBuf bf)
static java.util.Optional<java.util.Optional<byte[]>>
readMaybeOptRangedBytes(io.netty.buffer.ByteBuf bf)
Read a range of bytes prefixed by its length (encoded as a signed VInt).static java.util.Optional<java.util.Optional<java.lang.String>>
readMaybeOptString(io.netty.buffer.ByteBuf bf)
static java.util.Optional<byte[]>
readMaybeRangedBytes(io.netty.buffer.ByteBuf bf)
Reads a range of bytes if possible.static java.util.Optional<byte[]>
readMaybeRangedBytes(io.netty.buffer.ByteBuf bf, int length)
static java.util.Optional<java.lang.Integer>
readMaybeSignedInt(io.netty.buffer.ByteBuf bf)
static java.util.Optional<java.lang.String>
readMaybeString(io.netty.buffer.ByteBuf bf)
Reads a string if possible.static java.util.Optional<java.lang.Integer>
readMaybeVInt(io.netty.buffer.ByteBuf bf)
Reads a variable size int if possible.static java.util.Optional<java.lang.Long>
readMaybeVLong(io.netty.buffer.ByteBuf bf)
Reads a variable long if possible.static java.util.Optional<byte[]>
readOptRangedBytes(io.netty.buffer.ByteBuf bf)
Reads optional range of bytes.static java.util.Optional<java.lang.String>
readOptString(io.netty.buffer.ByteBuf bf)
Reads an optional String.static byte[]
readRangedBytes(io.netty.buffer.ByteBuf bf)
static byte[]
readRangedBytes(io.netty.buffer.ByteBuf bf, int length)
static java.lang.String
readString(io.netty.buffer.ByteBuf bf)
Reads length of String and then returns an UTF-8 formatted String of such length.static int
readUnsignedInt(io.netty.buffer.ByteBuf bf)
static long
readUnsignedLong(io.netty.buffer.ByteBuf bf)
static int
readUnsignedShort(io.netty.buffer.ByteBuf bf)
static io.netty.buffer.ByteBuf
wrappedBuffer(byte[]... arrays)
static void
writeRangedBytes(byte[] src, int offset, io.netty.buffer.ByteBuf bf)
static void
writeRangedBytes(byte[] src, io.netty.buffer.ByteBuf bf)
static void
writeString(java.lang.String msg, io.netty.buffer.ByteBuf bf)
static void
writeString(java.util.Optional<java.lang.String> msg, io.netty.buffer.ByteBuf bf)
static void
writeUnsignedInt(int i, io.netty.buffer.ByteBuf bf)
static void
writeUnsignedLong(long l, io.netty.buffer.ByteBuf bf)
static void
writeUnsignedShort(int i, io.netty.buffer.ByteBuf bf)
static void
writeXid(javax.transaction.xa.Xid xid, io.netty.buffer.ByteBuf buffer)
-
-
-
Method Detail
-
wrappedBuffer
public static io.netty.buffer.ByteBuf wrappedBuffer(byte[]... arrays)
-
buffer
public static io.netty.buffer.ByteBuf buffer(int capacity)
-
dynamicBuffer
public static io.netty.buffer.ByteBuf dynamicBuffer()
-
readUnsignedShort
public static int readUnsignedShort(io.netty.buffer.ByteBuf bf)
-
readUnsignedInt
public static int readUnsignedInt(io.netty.buffer.ByteBuf bf)
-
readUnsignedLong
public static long readUnsignedLong(io.netty.buffer.ByteBuf bf)
-
readRangedBytes
public static byte[] readRangedBytes(io.netty.buffer.ByteBuf bf)
-
readRangedBytes
public static byte[] readRangedBytes(io.netty.buffer.ByteBuf bf, int length)
-
readOptRangedBytes
public static java.util.Optional<byte[]> readOptRangedBytes(io.netty.buffer.ByteBuf bf)
Reads optional range of bytes. Negative lengths are translated to None, 0 length represents empty Array
-
readOptString
public static java.util.Optional<java.lang.String> readOptString(io.netty.buffer.ByteBuf bf)
Reads an optional String. 0 length is an empty string, negative length is translated to None.
-
readString
public static java.lang.String readString(io.netty.buffer.ByteBuf bf)
Reads length of String and then returns an UTF-8 formatted String of such length. If the length is 0, an empty String is returned.
-
readMaybeByte
public static java.util.Optional<java.lang.Byte> readMaybeByte(io.netty.buffer.ByteBuf bf)
Reads a byte if possible. If not present the reader index is reset to the last mark.- Parameters:
bf
-- Returns:
-
readMaybeLong
public static java.util.Optional<java.lang.Long> readMaybeLong(io.netty.buffer.ByteBuf bf)
-
readMaybeVLong
public static java.util.Optional<java.lang.Long> readMaybeVLong(io.netty.buffer.ByteBuf bf)
Reads a variable long if possible. If not present the reader index is reset to the last mark.- Parameters:
bf
-- Returns:
-
readMaybeVInt
public static java.util.Optional<java.lang.Integer> readMaybeVInt(io.netty.buffer.ByteBuf bf)
Reads a variable size int if possible. If not present the reader index is reset to the last mark.- Parameters:
bf
-- Returns:
-
readMaybeRangedBytes
public static java.util.Optional<byte[]> readMaybeRangedBytes(io.netty.buffer.ByteBuf bf)
Reads a range of bytes if possible. If not present the reader index is reset to the last mark.- Parameters:
bf
-- Returns:
-
readMaybeRangedBytes
public static java.util.Optional<byte[]> readMaybeRangedBytes(io.netty.buffer.ByteBuf bf, int length)
-
readMaybeSignedInt
public static java.util.Optional<java.lang.Integer> readMaybeSignedInt(io.netty.buffer.ByteBuf bf)
-
readMaybeOptRangedBytes
public static java.util.Optional<java.util.Optional<byte[]>> readMaybeOptRangedBytes(io.netty.buffer.ByteBuf bf)
Read a range of bytes prefixed by its length (encoded as a signed VInt).- Returns:
Optional(Optional(byte[])
if it could read the range,Optional(Optional.empty())
if the length was negative, orOptional.empty()
if the input buffer didn't contain the entire range.
-
readMaybeString
public static java.util.Optional<java.lang.String> readMaybeString(io.netty.buffer.ByteBuf bf)
Reads a string if possible. If not present the reader index is reset to the last mark.- Parameters:
bf
-- Returns:
-
readMaybeOptString
public static java.util.Optional<java.util.Optional<java.lang.String>> readMaybeOptString(io.netty.buffer.ByteBuf bf)
-
writeUnsignedShort
public static void writeUnsignedShort(int i, io.netty.buffer.ByteBuf bf)
-
writeUnsignedInt
public static void writeUnsignedInt(int i, io.netty.buffer.ByteBuf bf)
-
writeUnsignedLong
public static void writeUnsignedLong(long l, io.netty.buffer.ByteBuf bf)
-
writeRangedBytes
public static void writeRangedBytes(byte[] src, io.netty.buffer.ByteBuf bf)
-
writeRangedBytes
public static void writeRangedBytes(byte[] src, int offset, io.netty.buffer.ByteBuf bf)
-
writeString
public static void writeString(java.lang.String msg, io.netty.buffer.ByteBuf bf)
-
writeString
public static void writeString(java.util.Optional<java.lang.String> msg, io.netty.buffer.ByteBuf bf)
-
writeXid
public static void writeXid(javax.transaction.xa.Xid xid, io.netty.buffer.ByteBuf buffer)
-
-