public final class LittleEndian extends Object
| Modifier and Type | Method and Description |
|---|---|
static int |
decodeInt(byte[] in)
Decodes the first 4 bytes of the given array into an
int
value using little-endian byte ordering convention. |
static int |
decodeInt(byte[] in,
int off)
Decodes the first 4 bytes starting at
off of the given array
into an int value using little-endian byte ordering
convention. |
static long |
decodeLong(byte[] in)
Decodes the first 8 bytes of the given array into a
long
value using little-endian byte ordering convention. |
static long |
decodeLong(byte[] in,
int off)
Decodes the first 8 bytes starting at
off of the given array
into a long value using little-endian byte ordering
convention. |
static byte[] |
encode(int n)
Encodes the given
int value using little-endian byte ordering
convention. |
static void |
encode(int n,
byte[] out,
int off)
Encodes the given
int value using little-endian byte ordering
convention into the given array, starting at the given offset. |
static byte[] |
encode(long n)
Encodes the given
long value using little-endian byte
ordering convention. |
static void |
encode(long n,
byte[] out,
int off)
Encodes the given
long value using little-endian byte
ordering convention into the given array, starting at the given
offset. |
public static byte[] encode(int n)
int value using little-endian byte ordering
convention.n - the int value to encode.public static void encode(int n,
byte[] out,
int off)
int value using little-endian byte ordering
convention into the given array, starting at the given offset.n - the int value to encode.out - the output buffer.off - the output offset.NullPointerException - if out is null.IndexOutOfBoundsException - if off is negative or if
out's length is lower than off + 4.public static byte[] encode(long n)
long value using little-endian byte
ordering convention.n - the long value to encode.public static void encode(long n,
byte[] out,
int off)
long value using little-endian byte
ordering convention into the given array, starting at the given
offset.n - the long value to encode.out - the output buffer.off - the output offset.NullPointerException - if out is null.IndexOutOfBoundsException - if off is negative or if
out's length is lower than off + 8.public static int decodeInt(byte[] in)
int
value using little-endian byte ordering convention.in - the encoded value.int value.NullPointerException - if in is null.IndexOutOfBoundsException - if in's length is lower
than 4.public static int decodeInt(byte[] in,
int off)
off of the given array
into an int value using little-endian byte ordering
convention.in - the encoded value.off - the input offset.int value.NullPointerException - if in is null.IndexOutOfBoundsException - if off is negative or if
in's length is lower than off + 4.public static long decodeLong(byte[] in)
long
value using little-endian byte ordering convention.in - the encoded value.long value.NullPointerException - if in is null.IndexOutOfBoundsException - if in's length is lower
than 8.public static long decodeLong(byte[] in,
int off)
off of the given array
into a long value using little-endian byte ordering
convention.in - the encoded value.off - the input offset.long value.NullPointerException - if in is null.IndexOutOfBoundsException - if off is negative or if
in's length is lower than off + 8.Copyright © 2012–2015. All rights reserved.