@Test public void testCreateReader() throws Exception { String s = "sssssssssssssss"; String cs = "UTF-8"; char[] ca = new char[100]; InputStream is = new ByteArrayInputStream(s.getBytes(cs)); Map<String, String> parameters = new LinkedHashMap<String, String>(); parameters.put("CharSet", cs); MediaType mediaType = new MediaType("application", "atom+xml", parameters); Reader r = ProviderUtils.createReader(is, mediaType); int size = r.read(ca); String s2 = new String(ca, 0, size); assertEquals(s2, s); is = new ByteArrayInputStream(s.getBytes("UTF-16")); parameters = new LinkedHashMap<String, String>(); parameters.put("CharSet", cs); mediaType = new MediaType("application", "atom+xml", parameters); r = ProviderUtils.createReader(is, mediaType); size = r.read(ca); s2 = new String(ca, 0, size); assertNotSame(s, s2); }
public static Reader createReader(InputStream stream, MediaType mediaType) { Charset charset = Charset.forName(getCharset(mediaType)); return new InputStreamReader(stream, charset); }
ProviderUtils { public static Reader createReader(InputStream stream, MediaType mediaType) { Charset charset = Charset.forName(getCharset(mediaType)); return new InputStreamReader(stream, charset); } }
ProviderUtils { public static Reader createReader(InputStream stream, MediaType mediaType) { Charset charset = Charset.forName(getCharset(mediaType)); return new InputStreamReader(stream, charset); }  }
ProviderUtils { public static Reader createReader(InputStream stream, MediaType mediaType) { Charset charset = Charset.forName(getCharset(mediaType)); return new InputStreamReader(stream, charset); }  static String getCharsetOrNull(MediaType m); static String getCharset(MediaType m); static String getCharset(MediaType m, HttpHeaders requestHeaders); static Reader createReader(InputStream stream, MediaType mediaType); static Writer createWriter(OutputStream stream, MediaType mediaType); static byte[] readFromStreamAsBytes(InputStream stream); static String readFromStreamAsString(InputStream stream, MediaType mt); static void writeToStream(String string, OutputStream os, MediaType mt); static void copyStream(InputStream src, OutputStream dst); static String writeToString(Providers providers, Object object, MediaType mediaType); static String writeToString(Providers providers,
                                       Object object,
                                       Class<?> type,
                                       MediaType mediaType); static String writeToString(Providers providers,
                                       Object object,
                                       Class<?> type,
                                       Type genericType,
                                       MediaType mediaType); @SuppressWarnings("unchecked") static String writeToString(Providers providers,
                                       Object object,
                                       Class<?> type,
                                       Type genericType,
                                       MultivaluedMap<String, Object> httpHeaders,
                                       MediaType mediaType); static T readFromString(Providers providers,
                                       String input,
                                       Class<T> type,
                                       MediaType mediaType); static T readFromString(Providers providers,
                                       String input,
                                       Class<T> type,
                                       Type genericType,
                                       MediaType mediaType); static T readFromString(Providers providers,
                                       String input,
                                       Class<T> type,
                                       Type genericType,
                                       MultivaluedMap<String, String> httpHeaders,
                                       MediaType mediaType); static void logUserProviderException(RuntimeException e,
            Object obj, // MessageBodyReader or MessageBodyWriter
            PROVIDER_EXCEPTION_ORIGINATOR originator,
            Object[] methodParams,
            RuntimeContext context); }
ProviderUtils { public static Reader createReader(InputStream stream, MediaType mediaType) { Charset charset = Charset.forName(getCharset(mediaType)); return new InputStreamReader(stream, charset); }  static String getCharsetOrNull(MediaType m); static String getCharset(MediaType m); static String getCharset(MediaType m, HttpHeaders requestHeaders); static Reader createReader(InputStream stream, MediaType mediaType); static Writer createWriter(OutputStream stream, MediaType mediaType); static byte[] readFromStreamAsBytes(InputStream stream); static String readFromStreamAsString(InputStream stream, MediaType mt); static void writeToStream(String string, OutputStream os, MediaType mt); static void copyStream(InputStream src, OutputStream dst); static String writeToString(Providers providers, Object object, MediaType mediaType); static String writeToString(Providers providers,
                                       Object object,
                                       Class<?> type,
                                       MediaType mediaType); static String writeToString(Providers providers,
                                       Object object,
                                       Class<?> type,
                                       Type genericType,
                                       MediaType mediaType); @SuppressWarnings("unchecked") static String writeToString(Providers providers,
                                       Object object,
                                       Class<?> type,
                                       Type genericType,
                                       MultivaluedMap<String, Object> httpHeaders,
                                       MediaType mediaType); static T readFromString(Providers providers,
                                       String input,
                                       Class<T> type,
                                       MediaType mediaType); static T readFromString(Providers providers,
                                       String input,
                                       Class<T> type,
                                       Type genericType,
                                       MediaType mediaType); static T readFromString(Providers providers,
                                       String input,
                                       Class<T> type,
                                       Type genericType,
                                       MultivaluedMap<String, String> httpHeaders,
                                       MediaType mediaType); static void logUserProviderException(RuntimeException e,
            Object obj, // MessageBodyReader or MessageBodyWriter
            PROVIDER_EXCEPTION_ORIGINATOR originator,
            Object[] methodParams,
            RuntimeContext context);  }