commit | 3a58d83fb0994cd3f3d38cbb2225a8105e317a50 | [log] [tgz] |
---|---|---|
author | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | Sat Dec 18 20:56:34 2021 +0100 |
committer | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | Sat Dec 18 20:56:34 2021 +0100 |
tree | 72381c96d742157d62936bb2a9328abbe806d326 | |
parent | 828cecb52fff0c8d2ad87309b15d822c2015d05e [diff] |
README: Bump library version to 0.1.3. Change-Id: Ib19fb5aed31b9a39e3fda56a7f58aff3c95388e4
This library provides a GVariant parser in pure Java.
Instances of Decoder<T>
read a given type of GVariant-encoded value from a ByteBuffer. The class also contains factory methods to acquire 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));
<project> ... <dependencies> ... <dependency> <groupId>eu.mulk.jgvariant</groupId> <artifactId>jgvariant-core</artifactId> <version>0.1.3</version> </dependency> ... </dependencies> ... </project>
dependencies { ... implementation("eu.mulk.jgvariant:jgvariant-core:0.1.3") ... }