Skip to content

๐Ÿ”Œ High performance and flexible binary streams reader and writer implementations

License

Notifications You must be signed in to change notification settings

exception/Jacobin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

29 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ”Œ Jacobin

jitpack javadocs tests license

Jacobin provides high performance binary streams reader and writer implementations, as well as bidirectional stream implementations.

Features

  • 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

Getting started

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).

Creating a ByteStreamReader

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();
}

Creating a ByteStreamWriter

TODO

Creating an InOutByteStream

TODO

Check out the Javadocs to see a list of all the available classes and methods.

License

MIT ยฉ Hugo Manrique

About

๐Ÿ”Œ High performance and flexible binary streams reader and writer implementations

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •