@Test public void testOctetStreamToTextConversion() { String text = "Have you ever retired a human by mistake?"; byte[] bytes1 = text.getBytes(); byte[] bytes2 = new byte[]{1, 2, 3}; byte[] result1 = StandardConversions.convertOctetStreamToText(bytes1, TEXT_PLAIN.withCharset(US_ASCII)); byte[] result2 = StandardConversions.convertOctetStreamToText(bytes2, TEXT_PLAIN); assertArrayEquals(text.getBytes(US_ASCII), result1); assertArrayEquals(new String(bytes2).getBytes(UTF_8), result2); }
public static byte[] convertOctetStreamToText(byte[] source, MediaType destination) { if (source == null) return null; return convertCharset(source, UTF_8, destination.getCharset()); }
StandardConversions { public static byte[] convertOctetStreamToText(byte[] source, MediaType destination) { if (source == null) return null; return convertCharset(source, UTF_8, destination.getCharset()); } }
StandardConversions { public static byte[] convertOctetStreamToText(byte[] source, MediaType destination) { if (source == null) return null; return convertCharset(source, UTF_8, destination.getCharset()); }  }
StandardConversions { public static byte[] convertOctetStreamToText(byte[] source, MediaType destination) { if (source == null) return null; return convertCharset(source, UTF_8, destination.getCharset()); }  static Object convertTextToText(Object source, MediaType sourceType, MediaType destinationType); static byte[] convertTextToOctetStream(Object source, MediaType sourceType); static String convertTextToObject(Object source, MediaType sourceType); static String convertTextToUrlEncoded(Object source, MediaType sourceType); static byte[] convertOctetStreamToText(byte[] source, MediaType destination); static Object convertOctetStreamToJava(byte[] source, MediaType destination, Marshaller marshaller); static byte[] convertJavaToOctetStream(Object source, MediaType sourceMediaType, Marshaller marshaller); static byte[] convertJavaToProtoStream(Object source, MediaType sourceMediaType, ImmutableSerializationContext ctx); static byte[] convertJavaToText(Object source, MediaType sourceMediaType, MediaType destinationMediaType); static Object decodeObjectContent(Object content, MediaType contentMediaType); static byte[] convertCharset(Object content, Charset fromCharset, Charset toCharset); static byte[] decodeOctetStream(Object input, MediaType octetStream); static String bytesToHex(byte[] bytes); static byte[] hexToBytes(String hex); static Object convertUrlEncodedToObject(Object content); static Object convertUrlEncodedToText(Object content, MediaType destinationType); static Object convertUrlEncodedToOctetStream(Object content); static String urlEncode(Object content, MediaType mediaType); static Object urlDecode(Object content); static Object convertOctetStreamToUrlEncoded(Object content, MediaType contentType); }
StandardConversions { public static byte[] convertOctetStreamToText(byte[] source, MediaType destination) { if (source == null) return null; return convertCharset(source, UTF_8, destination.getCharset()); }  static Object convertTextToText(Object source, MediaType sourceType, MediaType destinationType); static byte[] convertTextToOctetStream(Object source, MediaType sourceType); static String convertTextToObject(Object source, MediaType sourceType); static String convertTextToUrlEncoded(Object source, MediaType sourceType); static byte[] convertOctetStreamToText(byte[] source, MediaType destination); static Object convertOctetStreamToJava(byte[] source, MediaType destination, Marshaller marshaller); static byte[] convertJavaToOctetStream(Object source, MediaType sourceMediaType, Marshaller marshaller); static byte[] convertJavaToProtoStream(Object source, MediaType sourceMediaType, ImmutableSerializationContext ctx); static byte[] convertJavaToText(Object source, MediaType sourceMediaType, MediaType destinationMediaType); static Object decodeObjectContent(Object content, MediaType contentMediaType); static byte[] convertCharset(Object content, Charset fromCharset, Charset toCharset); static byte[] decodeOctetStream(Object input, MediaType octetStream); static String bytesToHex(byte[] bytes); static byte[] hexToBytes(String hex); static Object convertUrlEncodedToObject(Object content); static Object convertUrlEncodedToText(Object content, MediaType destinationType); static Object convertUrlEncodedToOctetStream(Object content); static String urlEncode(Object content, MediaType mediaType); static Object urlDecode(Object content); static Object convertOctetStreamToUrlEncoded(Object content, MediaType contentType);  }