Package org.jitsi.util
Class ArrayIOUtils
- java.lang.Object
-
- org.jitsi.util.ArrayIOUtils
-
public class ArrayIOUtils extends Object
Implements functionality aiding the reading and writing in little endian of byte arrays and primitive types such as short.- Author:
- Lyubomir Marinov
-
-
Constructor Summary
Constructors Constructor Description ArrayIOUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intreadInt(byte[] in, int inOffset)Reads an integer from a specific series of bytes starting the reading at a specific offset in it.static intreadInt16(byte[] in, int inOffset)Reads a short integer from a specific series of bytes starting the reading at a specific offset in it.static shortreadShort(byte[] in, int inOffset)Reads a short integer from a specific series of bytes starting the reading at a specific offset in it.static voidwriteInt(int in, byte[] out, int outOffset)Converts an integer to a series of bytes and writes the result into a specific output array of bytes starting the writing at a specific offset in it.static voidwriteInt16(int in, byte[] out, int outOffset)Converts a short integer to a series of bytes and writes the result into a specific output array of bytes starting the writing at a specific offset in it.static voidwriteShort(short in, byte[] out, int outOffset)Converts a short integer to a series of bytes and writes the result into a specific output array of bytes starting the writing at a specific offset in it.
-
-
-
Method Detail
-
readInt
public static int readInt(byte[] in, int inOffset)Reads an integer from a specific series of bytes starting the reading at a specific offset in it.- Parameters:
in- the series of bytes to read an integer frominOffset- the offset in in at which the reading of the integer is to start- Returns:
- an integer read from the specified series of bytes starting at the specified offset in it
-
readInt16
public static int readInt16(byte[] in, int inOffset)Reads a short integer from a specific series of bytes starting the reading at a specific offset in it. The difference withreadShort(byte[], int)is that the read short integer is an int which has been formed by reading two bytes, not a short.- Parameters:
in- the series of bytes to read the short integer frominOffset- the offset in in at which the reading of the short integer is to start- Returns:
- a short integer in the form of int read from the specified series of bytes starting at the specified offset in it
-
readShort
public static short readShort(byte[] in, int inOffset)Reads a short integer from a specific series of bytes starting the reading at a specific offset in it.- Parameters:
in- the series of bytes to read the short integer frominOffset- the offset in in at which the reading of the short integer is to start- Returns:
- a short integer in the form of short read from the specified series of bytes starting at the specified offset in it
-
writeInt
public static void writeInt(int in, byte[] out, int outOffset)Converts an integer to a series of bytes and writes the result into a specific output array of bytes starting the writing at a specific offset in it.- Parameters:
in- the integer to be written out as a series of bytesout- the output to receive the conversion of the specified integer to a series of bytesoutOffset- the offset in out at which the writing of the result of the conversion is to be started
-
writeInt16
public static void writeInt16(int in, byte[] out, int outOffset)Converts a short integer to a series of bytes and writes the result into a specific output array of bytes starting the writing at a specific offset in it. The difference withwriteShort(short, byte[], int)is that the input is an int and just two bytes of it are written.- Parameters:
in- the short integer to be written out as a series of bytes specified as an integer i.e. the value to be converted is contained in only two of the four bytes made available by the integerout- the output to receive the conversion of the specified short integer to a series of bytesoutOffset- the offset in out at which the writing of the result of the conversion is to be started
-
writeShort
public static void writeShort(short in, byte[] out, int outOffset)Converts a short integer to a series of bytes and writes the result into a specific output array of bytes starting the writing at a specific offset in it.- Parameters:
in- the short integer to be written out as a series of bytes specified as shortout- the output to receive the conversion of the specified short integer to a series of bytesoutOffset- the offset in out at which the writing of the result of the conversion is to be started
-
-