Package org.infinispan.commons.io
Class UnsignedNumeric
- java.lang.Object
-
- org.infinispan.commons.io.UnsignedNumeric
-
public class UnsignedNumeric extends Object
Helper to read and write unsigned numerics- Since:
- 4.0
- Author:
- Manik Surtani
-
-
Constructor Summary
Constructors Constructor Description UnsignedNumeric()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static int
readUnsignedInt(byte[] bytes, int offset)
Reads an int stored in variable-length format.static int
readUnsignedInt(InputStream in)
static int
readUnsignedInt(ObjectInput in)
Reads an int stored in variable-length format.static int
readUnsignedInt(ByteBuffer in)
static long
readUnsignedLong(byte[] bytes, int offset)
Reads an int stored in variable-length format.static long
readUnsignedLong(InputStream in)
static long
readUnsignedLong(ObjectInput in)
Reads a long stored in variable-length format.static long
readUnsignedLong(ByteBuffer in)
static byte
sizeUnsignedInt(int i)
static int
writeUnsignedInt(byte[] bytes, int offset, int i)
Writes an int in a variable-length format.static void
writeUnsignedInt(ObjectOutput out, int i)
Writes an int in a variable-length format.static void
writeUnsignedInt(OutputStream out, int i)
static void
writeUnsignedInt(ByteBuffer out, int i)
static void
writeUnsignedLong(byte[] bytes, int offset, long i)
Writes an int in a variable-length format.static void
writeUnsignedLong(ObjectOutput out, long i)
Writes a long in a variable-length format.static void
writeUnsignedLong(OutputStream out, long i)
static void
writeUnsignedLong(ByteBuffer out, long i)
-
-
-
Method Detail
-
readUnsignedInt
public static int readUnsignedInt(ObjectInput in) throws IOException
Reads an int stored in variable-length format. Reads between one and five bytes. Smaller values take fewer bytes. Negative numbers are not supported.- Throws:
IOException
-
readUnsignedInt
public static int readUnsignedInt(InputStream in) throws IOException
- Throws:
IOException
-
readUnsignedInt
public static int readUnsignedInt(ByteBuffer in)
-
writeUnsignedInt
public static void writeUnsignedInt(ObjectOutput out, int i) throws IOException
Writes an int in a variable-length format. Writes between one and five bytes. Smaller values take fewer bytes. Negative numbers are not supported.- Parameters:
i
- int to write- Throws:
IOException
-
writeUnsignedInt
public static void writeUnsignedInt(OutputStream out, int i) throws IOException
- Throws:
IOException
-
sizeUnsignedInt
public static byte sizeUnsignedInt(int i)
-
writeUnsignedInt
public static void writeUnsignedInt(ByteBuffer out, int i)
-
readUnsignedLong
public static long readUnsignedLong(ObjectInput in) throws IOException
Reads a long stored in variable-length format. Reads between one and nine bytes. Smaller values take fewer bytes. Negative numbers are not supported.- Throws:
IOException
-
readUnsignedLong
public static long readUnsignedLong(InputStream in) throws IOException
- Throws:
IOException
-
readUnsignedLong
public static long readUnsignedLong(ByteBuffer in)
-
writeUnsignedLong
public static void writeUnsignedLong(ObjectOutput out, long i) throws IOException
Writes a long in a variable-length format. Writes between one and nine bytes. Smaller values take fewer bytes. Negative numbers are not supported.- Parameters:
i
- int to write- Throws:
IOException
-
writeUnsignedLong
public static void writeUnsignedLong(OutputStream out, long i) throws IOException
- Throws:
IOException
-
writeUnsignedLong
public static void writeUnsignedLong(ByteBuffer out, long i)
-
readUnsignedInt
public static int readUnsignedInt(byte[] bytes, int offset)
Reads an int stored in variable-length format. Reads between one and five bytes. Smaller values take fewer bytes. Negative numbers are not supported.
-
writeUnsignedInt
public static int writeUnsignedInt(byte[] bytes, int offset, int i)
Writes an int in a variable-length format. Writes between one and five bytes. Smaller values take fewer bytes. Negative numbers are not supported.- Parameters:
i
- int to write
-
readUnsignedLong
public static long readUnsignedLong(byte[] bytes, int offset)
Reads an int stored in variable-length format. Reads between one and nine bytes. Smaller values take fewer bytes. Negative numbers are not supported.
-
writeUnsignedLong
public static void writeUnsignedLong(byte[] bytes, int offset, long i)
Writes an int in a variable-length format. Writes between one and nine bytes. Smaller values take fewer bytes. Negative numbers are not supported.- Parameters:
i
- int to write
-
-