Encodings { public static String base64URLSafe(byte[] value) { return Base64.getUrlEncoder().encodeToString(value); }  static String uriComponent(String value); static String decodeURIComponent(String value); static String base64(String value); static String base64(byte[] value); static byte[] decodeBase64(String value); static String base64URLSafe(byte[] value); static byte[] decodeBase64URLSafe(String value); static String hex(byte[] bytes);  }
@Test void base64URLSafe() { byte[] bytes = new byte[256]; for (int i = 0; i < bytes.length; i++) { bytes[i] = (byte) i; } String encodedMessage = Encodings.base64URLSafe(bytes); assertThat(Encodings.decodeBase64URLSafe(encodedMessage)).containsExactly(bytes); }