Properly document jgvariant-ostree.

Change-Id: I0aa3b1df512ef99d0e25d73efdd34a1b488e7d0d
diff --git a/jgvariant-ostree/src/main/java/eu/mulk/jgvariant/ostree/ByteString.java b/jgvariant-ostree/src/main/java/eu/mulk/jgvariant/ostree/ByteString.java
index 1a85547..cf6e99a 100644
--- a/jgvariant-ostree/src/main/java/eu/mulk/jgvariant/ostree/ByteString.java
+++ b/jgvariant-ostree/src/main/java/eu/mulk/jgvariant/ostree/ByteString.java
@@ -3,15 +3,24 @@
 import eu.mulk.jgvariant.core.Decoder;
 import java.util.Arrays;
 import java.util.HexFormat;
+import java.util.stream.IntStream;
+import java.util.stream.Stream;
 
 /**
  * A wrapper for a {@code byte[]} that implements {@link #equals(Object)}, {@link #hashCode()}, and
  * {@link #toString()} according to value semantics.
+ *
+ * @param bytes the byte array that this ByteString wraps.
  */
 public record ByteString(byte[] bytes) {
 
   private static final Decoder<ByteString> DECODER = Decoder.ofByteArray().map(ByteString::new);
 
+  /**
+   * Returns a decoder for a {@code byte[]} that wraps the result in {@link ByteString}.
+   *
+   * @return a possibly shared {@link Decoder}.
+   */
   public static Decoder<ByteString> decoder() {
     return DECODER;
   }
@@ -31,11 +40,42 @@
     return "ByteString{hex=\"%s\"}".formatted(hex());
   }
 
+  /**
+   * Converts the contained byte array into a hex string.
+   *
+   * <p>Useful for printing.
+   *
+   * @return a hex string representation of this byte string.
+   */
   public String hex() {
     return HexFormat.of().formatHex(bytes);
   }
 
+  /**
+   * Parses a hex string into a {@link ByteString}.
+   *
+   * @param hex a hex string.
+   * @return a {@link ByteString} corresponding to the given hex string.
+   */
   public static ByteString ofHex(String hex) {
     return new ByteString(HexFormat.of().parseHex(hex));
   }
+
+  /**
+   * Returns the number of bytes in the byte string.
+   *
+   * @return the number of bytes in the byte string.
+   */
+  public int size() {
+    return bytes.length;
+  }
+
+  /**
+   * Returns a {@link Stream} of all the bytes in the byte string.
+   *
+   * @return a new {@link Stream}.
+   */
+  Stream<Byte> stream() {
+    return IntStream.range(0, bytes.length).mapToObj(i -> bytes[i]);
+  }
 }