Document repository layout, add modified Base64 ByteString encoding.

Change-Id: I564db0e346346b608fa11527590e264c694fedaf
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 cf6e99a..bb8cbb6 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
@@ -2,6 +2,7 @@
 
 import eu.mulk.jgvariant.core.Decoder;
 import java.util.Arrays;
+import java.util.Base64;
 import java.util.HexFormat;
 import java.util.stream.IntStream;
 import java.util.stream.Stream;
@@ -62,6 +63,34 @@
   }
 
   /**
+   * Converts the contained byte array into modified Base64 (with {@code "/"} replaced with {@code
+   * "-"}).
+   *
+   * <p>Modified Base64 is Base64 with {@code "/"} replaced with {@code "_"}. It is used to address
+   * static deltas in an OSTree repository.
+   *
+   * <p>Useful for printing.
+   *
+   * @return a modified Base64 representation of the bytes making up this checksum.
+   */
+  public String modifiedBase64() {
+    return Base64.getEncoder().withoutPadding().encodeToString(bytes).replace('/', '_');
+  }
+
+  /**
+   * Parses a modified Base64 string into a {@link Checksum}.
+   *
+   * <p>Modified Base64 is Base64 with {@code "/"} replaced with {@code "_"}. It is used to address
+   * static deltas in an OSTree repository.
+   *
+   * @param mbase64 a hex string.
+   * @return a {@link Checksum} corresponding to the given modified Base64 string.
+   */
+  public static ByteString ofModifiedBase64(String mbase64) {
+    return new ByteString(Base64.getDecoder().decode(mbase64.replace('_', '/')));
+  }
+
+  /**
    * Returns the number of bytes in the byte string.
    *
    * @return the number of bytes in the byte string.