Jacobin provides high performance binary streams reader and writer implementations, as well as bidirectional stream implementations.
- Supports efficient offset setting (by only keeping the needed byte buffers in memory)
- Has different implementations for each endianness type
- Easy to make stream accesses and writes thread-safe
- Uses the Builder pattern to create the reader, writers and bidirectional streams
Install Jacobin using Maven by adding the JitPack repository to your pom.xml file:
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>Next, add the Jacobin dependency:
<dependency>
<groupId>com.github.hugmanrique</groupId>
<artifactId>Jacobin</artifactId>
<version>master-SNAPSHOT</version>
</dependency>You will need to have Java 8 version 45 or later (older versions might work).
Let's get started by creating a little-endian ByteStreamReader:
ByteStreamReader reader = new ByteStreamReaderBuilder()
.stream(new byte[] { 0x34, 0x12 })
.build();In this case we used the byte[] stream method, which will internally create a ByteArrayInputStream. Jacobin will use the native endianness by default (which in Intel and AMD modern CPUs is little-endian), but you can change this behaviour by calling #order(ByteOrder).
That's it! We can now call any method available in ByteStreamReader e.g.:
try {
reader.readInt16(); // will be 0x1234
} catch (IOException e) {
e.printStackTrace();
}TODO
TODO
Check out the Javadocs to see a list of all the available classes and methods.
MIT ยฉ Hugo Manrique