What is FastProto?

Build codecov Codacy JetBrains License

FastProto is a high-performance serialization/deserialization library designed for binary communication protocols. By defining complex byte stream structures with simple annotations, it enables Java developers to read and write custom binary packets in the most natural way for scenarios such as IoT, automotive systems, industrial control and energy metering.

Design Philosophy

  • Declarative over imperative: Protocol fields are defined via annotations, making the structure self‑evident so that code doubles as documentation.
  • Performance with maintainability: Architectural optimizations such as reflection caching and zero‑copy are built in to keep high throughput without sacrificing readability and maintainability.
  • Grounded in engineering reality: Supports mixed endianness, bit fields, BCD, CRC and other traditional protocol features to integrate smoothly with existing systems.

Key Features

Annotation‑Driven
Quickly map binary data to Java fields.
Broad Type Support
Primitives, unsigned numbers, strings, time types, arrays and collections.
Flexible Addressing
Reverse addressing for variable‑length packets.
Configurable Byte & Bit Order
Big‑endian or little‑endian; MSB/LSB bit ordering.
Custom Formulas
Use lambdas or classes to transform values during encode/decode.
Checksum/CRC
Single‑annotation @Checksum with CRC8/16/32/64, LRC, XOR.
Easy APIs
Multiple APIs tuned for efficiency and reliability.

Basic Usage

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

Install

Maven

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

Gradle

implementation "org.indunet:fastproto:3.12.1"

License

FastProto is released under the Apache License 2.0. Commercial‑friendly and widely adopted.

Source code on GitHub. Artifacts on Maven Central.