public class BytesArrayTools
extends java.lang.Object
Constructor and Description |
---|
BytesArrayTools() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
cleanStrings(java.lang.String str)
Remove trailing null bytes from string.
|
static int |
computeStringArraySize(java.lang.String[] strArray,
java.lang.String separator)
Compute size of string array once converted to byte array with separator
|
static byte[] |
readByteArray(byte[] src,
int start,
int end)
Read byte Array to byte Array
|
static int |
readInt(byte[] array,
int start)
Read int from a bytearray
|
static int |
readInt16Bits(byte[] array,
int start)
Read int from a bytearray of 16 bits
|
static long |
readLong(byte[] array,
int start)
Read long from a bytearray
|
static java.lang.String |
readString(byte[] array,
int start,
int size)
Read string from byte array
|
static java.lang.String |
readString(byte[] array,
int start,
java.lang.String endStr)
Read string from byte array
|
static java.lang.String[] |
readStringArray(byte[] byteArray,
int start,
int size,
java.lang.String separator)
Read string array from byte array starting at start with size parameter.
|
static void |
write(byte[] dst,
byte[] src,
int start)
Write byte Array to byte Array.
|
static void |
write(byte[] array,
int start,
int value)
Write int in a bytearray
|
static void |
write(byte[] array,
int start,
long value)
Write long in a bytearray
|
static void |
write(byte[] byteArray,
java.lang.String[] strArray,
int start,
java.lang.String separator)
Write a list of string to a byte array.
|
static void |
write(byte[] array,
java.lang.String str,
int start)
Write a string to a byte array.
|
static void |
write16Bits(byte[] array,
int start,
int value)
Write int in a bytearray 16 bits version
|
public static void write(byte[] array, int start, int value)
array
- the array to writestart
- where to begin writtingvalue
- int to writepublic static void write16Bits(byte[] array, int start, int value) throws SizeError
array
- the array to writestart
- where to begin writtingvalue
- int to writeSizeError
public static void write(byte[] array, int start, long value)
array
- the array to writestart
- where to begin writtingvalue
- long to writepublic static int readInt(byte[] array, int start) throws SizeError
array
- the array to readstart
- where to begin readingSizeError
public static int readInt16Bits(byte[] array, int start)
array
- the array to readstart
- where to begin readingpublic static long readLong(byte[] array, int start) throws SizeError
array
- the array to readstart
- where to begin readingSizeError
public static java.lang.String cleanStrings(java.lang.String str)
str
- input stringpublic static void write(byte[] byteArray, java.lang.String[] strArray, int start, java.lang.String separator) throws java.lang.InternalError
byteArray
- array to writestrArray
- string array to readstart
- start position to write in byteArrayseparator
- separator to usejava.lang.InternalError
public static java.lang.String[] readStringArray(byte[] byteArray, int start, int size, java.lang.String separator) throws java.lang.InternalError
byteArray
- Array to readstart
- Start positionsize
- Size to readseparator
- Separator usedjava.lang.InternalError
public static int computeStringArraySize(java.lang.String[] strArray, java.lang.String separator)
strArray
- String Arrayseparator
- Separator usedpublic static void write(byte[] array, java.lang.String str, int start) throws java.lang.InternalError
array
- Byte Array to writestr
- String to readstart
- Start position in byte array to writejava.lang.InternalError
public static java.lang.String readString(byte[] array, int start, int size) throws java.lang.InternalError
array
- Byte array to readstart
- start position in byte arraysize
- size to readjava.lang.InternalError
public static java.lang.String readString(byte[] array, int start, java.lang.String endStr) throws java.lang.InternalError
array
- Byte array to readstart
- start position in byte arrayendStr
- End string delimiterjava.lang.InternalError
public static void write(byte[] dst, byte[] src, int start)
dst
- Destination byte Arraysrc
- Source byte Arraystart
- Start in dest arraypublic static byte[] readByteArray(byte[] src, int start, int end) throws ProtocolError
src
- Source byte Arraystart
- Start position in sourceend
- End position in sourceProtocolError