This is a bare messages implementation for the JVM.
- Zero external dependencies and small, well structured code base
- Parsing of bare schemas
- Code generation for data structures, encoding and decoding methods out ouf bare schemas
- Decoding primitive data types from
InputStream
- Decoding aggregate data types from
InputStream
- Encoding primitive data types to
OutputStream
- Encoding aggregate data types to
OutputStream
- Reflective decoding of data types from
InputStream
bare-jvm | bare spec |
---|---|
String |
string |
byte |
byte |
boolean |
bool |
byte[] |
data |
byte[] |
data<length> |
float |
f32 |
double |
f64 |
@Int(Int.Type.i64) long |
i64 |
@Int(Int.Type.u64) BigInteger |
u64 |
@Int(Int.Type.i32) int |
i32 |
@Int(Int.Type.u32) long |
u32 |
@Int(Int.Type.i16) short |
i16 |
@Int(Int.Type.u16) int |
i16 |
@Int(Int.Type.u8) byte |
u8 |
@Int(Int.Type.i8) byte |
i8 |
@Int(Int.Type.i) long |
int |
@Int(Int.Type.ui) BigInteger |
uint |
bare-jvm | bare spec |
---|---|
List<T> |
[]type |
Array<T> |
[length]type |
Map<K,V> |
map[type A]type B |
Optional<T> |
optional<type> |
class Person {public String name;} |
struct |
Union u = new Union(Person.class, Account.class) |
tagged union |
-
Simply copy the required classes from
org.nobloat.bare
or add the dependency via -
Generate the data structures, encoding and decoding structures with
java -jar bare-jvm.jar schema.bare org.example.Messages
- This will create all data types in a class
Messages
underorg/example/Messages.java
- Java has no concept of unsigned primitive data types, hence double the amount of memory is required to safely use unsigned types:
u64
becomesBigInteger
u32
becomeslong
u16
becomesint
u8
becomesshort
- Anonymous structs are not supported by the code generator.