@Test public void testSerializeBinary() { ObjectNode jsonNode = JsonHandler.createObjectNode(); jsonNode.put("binary", "123456789az".getBytes()); byte[] result = CanonicalJsonFormatter.serializeToByteArray(jsonNode); assertThat(new String(result)).isEqualTo("{\"binary\":\"MTIzNDU2Nzg5YXo=\"}"); }
public static byte[] serializeToByteArray(JsonNode node) { try { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(1024); serialize(node, outputStream); return outputStream.toByteArray(); } catch (IOException e) { throw new IllegalStateException("Unexpected IO exception on memory stream", e); } }
CanonicalJsonFormatter { public static byte[] serializeToByteArray(JsonNode node) { try { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(1024); serialize(node, outputStream); return outputStream.toByteArray(); } catch (IOException e) { throw new IllegalStateException("Unexpected IO exception on memory stream", e); } } }
CanonicalJsonFormatter { public static byte[] serializeToByteArray(JsonNode node) { try { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(1024); serialize(node, outputStream); return outputStream.toByteArray(); } catch (IOException e) { throw new IllegalStateException("Unexpected IO exception on memory stream", e); } } private  CanonicalJsonFormatter(OutputStreamWriter writer); }
CanonicalJsonFormatter { public static byte[] serializeToByteArray(JsonNode node) { try { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(1024); serialize(node, outputStream); return outputStream.toByteArray(); } catch (IOException e) { throw new IllegalStateException("Unexpected IO exception on memory stream", e); } } private  CanonicalJsonFormatter(OutputStreamWriter writer); static InputStream serialize(JsonNode node); static byte[] serializeToByteArray(JsonNode node); static void serialize(JsonNode node, OutputStream outputStream); }
CanonicalJsonFormatter { public static byte[] serializeToByteArray(JsonNode node) { try { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(1024); serialize(node, outputStream); return outputStream.toByteArray(); } catch (IOException e) { throw new IllegalStateException("Unexpected IO exception on memory stream", e); } } private  CanonicalJsonFormatter(OutputStreamWriter writer); static InputStream serialize(JsonNode node); static byte[] serializeToByteArray(JsonNode node); static void serialize(JsonNode node, OutputStream outputStream);  }