public class ByteConversions extends Object
Constructor and Description |
---|
ByteConversions() |
Modifier and Type | Method and Description |
---|---|
byte[] |
concatByteArrays(byte[]... bytes) |
byte[] |
flattenByteArrays(byte[][] arr) |
byte[] |
getBytesFromLong(long in) |
int[] |
getIntArrayFromBytes(byte[] bytes,
int lengthOfIntInBits)
Fetches integers from the provided byte array.
|
int[] |
getIntArrayFromBytes(byte[] bytes,
int lengthOfIntInBits,
boolean littleEndian)
Fetches integers from the provided byte array.
|
long |
getLongFromBytes(byte[] b) |
byte[] |
intArrayToByteArray(int[] arr) |
public int[] getIntArrayFromBytes(byte[] bytes, int lengthOfIntInBits)
bytes
- the source byte arraylengthOfIntInBits
- the length of the integers in bitInvalidParameterException
- if the length of bytes does not math with the
requested bit lengthpublic int[] getIntArrayFromBytes(byte[] bytes, int lengthOfIntInBits, boolean littleEndian)
bytes
- the source byte arraylengthOfIntInBits
- the length of the integers in bitlittleEndian
- iff true, then the algorithm interprets the byte array
as little endian. Big endian otherwise.InvalidParameterException
- if the length of bytes does not math with the
requested bit lengthpublic byte[] getBytesFromLong(long in)
public long getLongFromBytes(byte[] b)
public byte[] flattenByteArrays(byte[][] arr)
public byte[] concatByteArrays(byte[]... bytes)
public byte[] intArrayToByteArray(int[] arr)
Copyright © 2020–2023 Stiftung SIC. All rights reserved.