Package org.ka2ddo.util
Class Ascii85
java.lang.Object
org.ka2ddo.util.Ascii85
This class provides means to encode and decode byte arrays into ASCII85 (base-85) strings.
An ASCII85 string encodes a sequence of bytes by taking the byte data 4 bytes at a time and factoring it into modulo-85 chunks, and then converting the modulos into printable US-ASCII characters, where modulo=0 -> '!', modulo=1 -> '"', etc., up to modulo=84 -> 'u' through the US-ASCII character set. 'z' is reserved to handle the special case of a 4-byte block that is all zero.
For more information, see https://en.wikipedia.org/wiki/Ascii85 for a description of the encoding algorithm.
- Author:
- Andrew Pavlin, KA2DDO
-
Method Summary
-
Method Details
-
encode
Encode a byte array into an ASCII-85-encoded string.- Parameters:
sequence
- byte array to encode- Returns:
- encoded String
-
decode
Decode a String in ASCII-85 encoding into a byte array- Parameters:
enc
- encoded String- Returns:
- byte array decoded from the String
-
main
unit test.- Parameters:
args
- String array, ignored
-