From 3f13b66f763fc6ecbedbb32971ba7807397a32f6 Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Sat, 18 Dec 2021 18:57:37 +0100 Subject: Slightly improved Javadocs. Change-Id: I9e572833ff368c98002cb7f81052a65af0f68ca2 --- src/main/java/eu/mulk/jgvariant/core/Decoder.java | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/main') diff --git a/src/main/java/eu/mulk/jgvariant/core/Decoder.java b/src/main/java/eu/mulk/jgvariant/core/Decoder.java index d30366e..461b9fa 100644 --- a/src/main/java/eu/mulk/jgvariant/core/Decoder.java +++ b/src/main/java/eu/mulk/jgvariant/core/Decoder.java @@ -52,6 +52,13 @@ public abstract class Decoder { /** * Decodes a {@link ByteBuffer} holding a serialized GVariant into a value of type {@code T}. * + *

Note: Due to the way the GVariant serialization format works, it is + * important that the start and end boundaries of the passed byte slice correspond to the actual + * start and end of the serialized value. The format does generally not allow for the dynamic + * discovery of the end of the data structure. + * + * @param byteSlice a byte slice holding a serialized GVariant. + * @return the deserialized value. * @throws java.nio.BufferUnderflowException if the byte buffer is shorter than the requested * data. * @throws IllegalArgumentException if the serialized GVariant is ill-formed @@ -239,6 +246,7 @@ public abstract class Decoder { *

Note: While GVariant does not prescribe any particular encoding, {@link * java.nio.charset.StandardCharsets#UTF_8} is the most common choice. * + * @param charset the {@link Charset} the string is encoded in. * @return a new {@link Decoder}. */ public static Decoder ofString(Charset charset) { -- cgit v1.2.3