tag | 5ce67c8d9287fbf0369da20f36b7f3d40dcdcb87 | |
---|---|---|
tagger | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | Sat Dec 18 10:55:26 2021 +0100 |
object | 9705fe965710a1f3daaf60bf41603cd08de66b47 |
[maven-scm] copy for tag v0.1.0
commit | 9705fe965710a1f3daaf60bf41603cd08de66b47 | [log] [tgz] |
---|---|---|
author | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | Sat Dec 18 10:40:57 2021 +0100 |
committer | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | Sat Dec 18 10:40:57 2021 +0100 |
tree | cef23602b3ba22c98af687a380f979b526206489 | |
parent | 8235756083016d5e1ef2bb54d05e2d1fe7c4bb38 [diff] |
Release 0.1.0. Change-Id: I78a525acb6c6a1d731dcfd70cff0346c0687a5ae
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));