https://github.com/fzakaria/ascii85
A Java library for working with Ascii85, also called Base85 - a form of binary-to-text encoding
https://github.com/fzakaria/ascii85
decoding encoding java
Last synced: over 1 year ago
JSON representation
A Java library for working with Ascii85, also called Base85 - a form of binary-to-text encoding
- Host: GitHub
- URL: https://github.com/fzakaria/ascii85
- Owner: fzakaria
- License: other
- Created: 2016-02-03T07:11:58.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2020-10-13T02:45:22.000Z (over 5 years ago)
- Last Synced: 2025-03-18T15:43:25.003Z (over 1 year ago)
- Topics: decoding, encoding, java
- Language: Java
- Size: 28.3 KB
- Stars: 17
- Watchers: 6
- Forks: 8
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Ascii85
[]()
```xml
com.github.fzakaria
ascii85
1.2
```
This is a very simple project with a Ascii85/Base85 codec (decoder & encoder). The version most similar to what is
implemented is the **Adobe Version**.
This codec supports:
1. using `u` to pad the last block
2. using `z` as a short form for all-zero group
In Ascii85-encoded blocks, whitespace and line-break characters may be present anywhere, including in the middle of a 5-character block, but they must be silently ignored.
> Ascii85, also called Base85, is a form of binary-to-text encoding developed by Paul E. Rutter for the btoa utility.
> By using five ASCII characters to represent four bytes of binary data (making the encoded size ¹⁄₄ larger than the original,
>assuming eight bits per ASCII character), it is more efficient than uuencode or Base64, which use four characters
>to represent three bytes of data (¹⁄₃ increase, assuming eight bits per ASCII character).
[Ascii85](https://en.wikipedia.org/wiki/Ascii85)
There are some included test cases that use the example given in the wiki link above.
```java
@Test
public void basicWikiDecodeTest() {
String encodedString = "9jqo^BlbD-BleB1DJ+*+F(f,q/0JhKFCj@.4Gp$d7F!,L7@<6@)/0JDEF@3BB/F*&OCAfu2/AKY" +
"i(DIb:@FD,*)+C]U=@3BN#EcYf8ATD3s@q?d$AftVqCh[NqF-FD5W8ARlolDIa" +
"l(DIduD.RTpAKYo'+CT/5+Cei#DII?(E,9)oF*2M7/c";
String solution = "Man is distinguished, not only by his reason, but by this singular passion from other animals, "+
"which is a lust of the mind, that by a perseverance of delight in the continued and indefatigable generation "+
"of knowledge, exceeds the short vehemence of any carnal pleasure.";
assertThat(solution, is(new String(Ascii85.decode(encodedString), StandardCharsets.US_ASCII)));
}
```