v4.1.0Apache 2.0

FastProto

Annotation-driven binary protocol serialization for Java.

Designed for IoT, automotive, industrial control & energy metering.

BuildcodecovCodacyJetBrainsLicense

Overview

What is FastProto?

FastProto is a high-performance Java library for binary protocol serialization and deserialization. Define complex byte-stream structures with annotations — no manual bit-shifting, no boilerplate. Built for production use cases including IoT gateways, CAN bus parsers, UART framing and Modbus register mapping.

Design philosophy
  • Declarative over imperative: Protocol structure expressed through annotations — the code reads like the protocol spec.
  • Performance with maintainability: Reflection metadata cached at startup; encode/decode paths are allocation-light.
  • Grounded in engineering reality: Mixed endianness, sub-byte fields, BCD encoding, CRC variants — all handled natively.

Key features

Annotation-driven

Map binary data to Java fields via simple annotations.

Broad type support

Primitives, unsigned, strings, time, arrays and collections.

Flexible addressing

Reverse addressing for variable-length packets.

Byte & bit order

Big-endian or little-endian; MSB/LSB bit ordering.

Custom formulas

Apply lambdas or classes to transform values on encode/decode.

Checksum / CRC

Single annotation: CRC8/16/32/64, LRC, XOR, sum.

Multiple APIs

Fluent builder and static helpers for all use cases.

Basic usage

Annotate fields, call FastProto.decode — done.

import org.indunet.fastproto.FastProto;
import org.indunet.fastproto.annotation.UInt8Type;

public class Packet {
  @UInt8Type(offset = 0) int id;
}

byte[] bytes = new byte[]{1};
Packet p = FastProto.decode(bytes, Packet.class);
byte[] out = FastProto.encode(p, 1);

Installation

Available on Maven Central. Requires Java 8+.

Maven

<dependency>
  <groupId>org.indunet</groupId>
  <artifactId>fastproto</artifactId>
  <version>4.1.0</version>
</dependency>

Gradle

implementation "org.indunet:fastproto:4.1.0"

Open source. Released under the Apache License 2.0. Source on GitHub. Artifacts on Maven Central.