public final class BitConverter
extends java.lang.Object
| Constructor and Description |
|---|
BitConverter() |
| Modifier and Type | Method and Description |
|---|---|
static int |
readInt(ArrayView source,
int position)
Reads a 32-bit integer from the given ArrayView starting at the given position.
|
static int |
readInt(byte[] source,
int position)
Reads a 32-bit integer from the given byte array starting at the given position.
|
static int |
readInt(java.io.InputStream source)
Reads a 32-bit integer from the given InputStream that was encoded using BitConverter.writeInt.
|
static long |
readLong(ArrayView source,
int position)
Reads a 64-bit long from the given ArrayView starting at the given position.
|
static long |
readLong(byte[] source,
int position)
Reads a 64-bit long from the given byte array starting at the given position.
|
static int |
writeInt(ArrayView target,
int offset,
int value)
Writes the given 32-bit Integer to the given ArrayView at the given offset.
|
static int |
writeInt(byte[] target,
int offset,
int value)
Writes the given 32-bit Integer to the given byte array at the given offset.
|
static int |
writeInt(java.io.OutputStream target,
int value)
Writes the given 32-bit Integer to the given OutputStream.
|
static int |
writeLong(ArrayView target,
int offset,
long value)
Writes the given 64-bit Long to the given ArrayView at the given offset.
|
static int |
writeLong(byte[] target,
int offset,
long value)
Writes the given 64-bit Long to the given byte array at the given offset.
|
public static int writeInt(ArrayView target, int offset, int value)
target - The ArrayView to write to.offset - The offset within the ArrayView to write at.value - The value to write.public static int writeInt(byte[] target,
int offset,
int value)
target - The byte array to write to.offset - The offset within the byte array to write at.value - The value to write.public static int writeInt(java.io.OutputStream target,
int value)
throws java.io.IOException
target - The OutputStream to write to.value - The value to write.java.io.IOException - If an exception got thrown.public static int readInt(byte[] source,
int position)
source - The byte array to read from.position - The position in the byte array to start reading at.public static int readInt(ArrayView source, int position)
source - The ArrayView to read from.position - The position in the ArrayView to start reading at.public static int readInt(java.io.InputStream source)
throws java.io.IOException
source - The InputStream to read from.java.io.IOException - If an exception got thrown.public static int writeLong(ArrayView target, int offset, long value)
target - The ArrayView to write to.offset - The offset within the ArrayView to write at.value - The value to write.public static int writeLong(byte[] target,
int offset,
long value)
target - The byte array to write to.offset - The offset within the byte array to write at.value - The value to write.public static long readLong(ArrayView source, int position)
source - The ArrayView to read from.position - The position in the ArrayView to start reading at.public static long readLong(byte[] source,
int position)
source - The byte array to read from.position - The position in the byte array to start reading at.