commit | 227fce4b98ec3a3b13e31f1d35219509e06f7edb | [log] [tgz] |
---|---|---|
author | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | Sat Dec 18 10:55:37 2021 +0100 |
committer | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | Sat Dec 18 10:55:37 2021 +0100 |
tree | 204558e03566d565952f84a0ae5cdb2c023eb45f | |
parent | 9705fe965710a1f3daaf60bf41603cd08de66b47 [diff] |
POM: Add release management plugins. Change-Id: I7fbd489f83c8e9b3e0586688f5517da0ebb565ac
This library provides a GVariant parser in pure Java.
The foundational class is Decoder
.
Instances of Decoder
read a given concrete subtype of Value
from a ByteBuffer. The class also contains factory methods to create those instances.
The various subclasses of Decoder
together implement the GVariant serialization specification.
To parse a GVariant value of type "a(si)"
, which is an array of pairs of String and int
, you can use the following code:
record ExampleRecord(String s, int i) {} var decoder = Decoder.ofArray( Decoder.ofStructure( ExampleRecord.class, Decoder.ofString(StandardCharsets.UTF_8), Decoder.ofInt().withByteOrder(ByteOrder.LITTLE_ENDIAN))); byte[] bytes = ...; List<ExampleRecord> example = decoder.decode(ByteBuffer.wrap(bytes));