A lightweight binary I/O library for Java projects
Part of the TANK Series.
- Read and write all Java primitive types
- Big-endian and little-endian support
- Variable-size bitfields (1–8 bytes)
- UTF-8 string serialization
- Sequential binary readers and writers
- Small, straightforward API
- Simple
- Lightweight
- Reusable
Currently, Breech is not on Maven Central. To use it, clone the repository and publish it to your local Maven Repository.
git clone https://github.com/breadcat-dev/breech.git
cd breech./gradlew publishToMavenLocal./gradlew.bat publishToMavenLocalOnce installed, add the dependency:
implementation "cat.breadcat:breech:<version>"implementation("cat.breadcat:breech:<version>")try(BinaryWriter writer = new BinaryWriter
(
new FileOutputStream("save.dat"),
ByteOrder.LITTLE_ENDIAN
))
{
writer.writeString("BreadCat");
writer.writeInt(64);
writer.writeFloat(3.14f);
}
catch(IOException e)
{
throw new RuntimeException(e);
}try(BinaryReader reader = new BinaryReader
(
new FileInputStream("save.dat"),
ByteOrder.LITTLE_ENDIAN
))
{
String name = reader.readString();
int coins = reader.readInt();
int exp = reader.readFloat();
}
catch(IOException e)
{
throw new RuntimeException(e);
}try(BinaryWriter writer = new BinaryWriter
(
new FileOutputStream("save.dat"),
ByteOrder.LITTLE_ENDIAN
))
{
Bitfield bitfield = new BitfieldBuilder(1)
.bit(true)
.bit(false)
.bit(true)
.build();
writer.writeBitfield(bitfield);
}
catch(IOException e)
{
throw new RuntimeException(e);
}- Toolbox - Github