commit | 8235756083016d5e1ef2bb54d05e2d1fe7c4bb38 | [log] [tgz] |
---|---|---|
author | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | Sat Dec 18 10:39:30 2021 +0100 |
committer | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | Sat Dec 18 10:39:30 2021 +0100 |
tree | fbad4a2fa90cbf612e12ac445f8461da605231af | |
parent | 8643a278abe9b721e5988a5b9f5498f9ba88da2a [diff] |
.mvn/jvm.config: Add workarounds for NEXUS-27902. Change-Id: I7038a5200fe50bd4f66bb727a709e400d00ca11e
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));