diff options
author | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | 2021-12-14 19:29:26 +0100 |
---|---|---|
committer | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | 2021-12-14 19:29:26 +0100 |
commit | 35f7a20b22271f8f28d15da8df85cff2fc9cd716 (patch) | |
tree | 496e011fd0cf8c34d2634ce991f287b6a4ee4838 /README.md | |
parent | 4c32c3998476e12c34984d52253eaa4ae3bf6769 (diff) |
Simplify types, replace Value with Variant.
Change-Id: I2e492ebfefc7e9a47c874ed22ff199412e9948ee
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -24,17 +24,17 @@ 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(Value.Str s, Value.Int32 i) {} + record ExampleRecord(String s, int i) {} var decoder = Decoder.ofArray( Decoder.ofStructure( ExampleRecord.class, - Decoder.ofStr(StandardCharsets.UTF_8), - Decoder.ofInt32().withByteOrder(ByteOrder.LITTLE_ENDIAN))); + Decoder.ofString(StandardCharsets.UTF_8), + Decoder.ofInt().withByteOrder(ByteOrder.LITTLE_ENDIAN))); byte[] bytes = ...; - Value.Array<Value.Structure<ExampleRecord>> example = decoder.decode(bytes); + List<ExampleRecord> example = decoder.decode(ByteBuffer.wrap(bytes)); [ByteBuffer]: https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/nio/ByteBuffer.html |