Skip to content

Java-library for for encoding/decoding a stream of bytes to pronounceable text

License

Notifications You must be signed in to change notification settings

aadnk/Bitspeak4j

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

74 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bitspeak4j

A Java-library for encoding/decoding byte streams into pronounceable text, based on a Javascript implementation and specification in MaiaVictor/Bitspeak.

Usage

To convert a byte array, select the Bitspeak format you would like to use (either BS-6 or BS-8) using Bitspeak.bs6() or Bitspeak.bs8(), then call the decode method:

// Returns "pakatape"
Bitspeak.bs6().encode(new byte[] { 1, 2, 3 }); 

The resulting string can be decoded using the decode method:

// Returns an array with [1, 2, 3]
Bitspeak.bs6().decode("pakatape")); 

It is also possible to write the bytes in an InputStream to a Writer with encoded Bitspeak:

Path input = Paths.get("input.data");
Path output = Paths.get("output.txt");

try (InputStream reader = Files.newInputStream(input);
     BufferedWriter writer = Files.newBufferedWriter(output)) {
    Bitspeak.bs6().encodeStream(reader, writer);
}

The reverse is also possible:

Path input = Paths.get("output.txt");
Path output = Paths.get("roundtrip.data");

try (BufferedReader reader = Files.newBufferedReader(input);
     OutputStream writer = Files.newOutputStream(output)) {
    Bitspeak.bs6().decodeStream(reader, writer);
}

Maven

You can use this as a Maven dependency, using the following repository:

<repository>
    <id>comphenix</id>
    <name>Comphenix Maven Public</name>
    <url>https://repo.comphenix.net/content/repositories/public/</url>
</repository>

Dependency:

<dependency>
    <groupId>com.comphenix</groupId>
    <artifactId>Bitspeak</artifactId>
    <version>0.3-SNAPSHOT</version>
    <scope>compile</scope>
</dependency>

License

This project is under the the LGPL v3 License, consult the LICENSE file for more information.

About

Java-library for for encoding/decoding a stream of bytes to pronounceable text

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages