Package de.das.encrypter.tools
Class ByteArrayConverter
java.lang.Object
de.das.encrypter.tools.ByteArrayConverter
This class provides a converter to build string from byte arrays and vice
versa, where the byte values greater than "0x7F" will be replaced by the
values where the MSB of the byte is set to "0" and the MSB itself is placed
as a bit into an appended table.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringAn identifier to indicate that a string represents a byte array. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyteArrayToString(byte[] data) Converts the given byte array into a string consisting of an identifier, a four-byte string representing the number of pure binary data plus four-byte CRC value, the reduced binary data plus CRC value and a table with the removed MSB bits.byte[]stringToByteArray(String str)
-
Field Details
-
IDENTIFIER
An identifier to indicate that a string represents a byte array.- See Also:
-
-
Constructor Details
-
ByteArrayConverter
public ByteArrayConverter()
-
-
Method Details
-
byteArrayToString
Converts the given byte array into a string consisting of an identifier, a four-byte string representing the number of pure binary data plus four-byte CRC value, the reduced binary data plus CRC value and a table with the removed MSB bits.- Parameters:
data- the given binary data.- Returns:
- the converted string.
- Throws:
Exception- in case of any error.
-
stringToByteArray
- Throws:
Exception
-