Here you can find the source of getInputStreamReader(InputStream in, String charset)
Parameter | Description |
---|---|
in | the input stream to wrap |
charset | the input stream to wrap |
public static Reader getInputStreamReader(InputStream in, String charset)
//package com.java2s; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.io.UnsupportedEncodingException; public class Main { /**/*from ww w. j a v a 2 s.c om*/ * Returns a reader for the specified input stream, using UTF-8 encoding. * @param in the input stream to wrap * @return a reader for this input stream */ public static Reader getInputStreamReader(InputStream in) { return getInputStreamReader(in, "UTF-8"); } /** * Returns a reader for the specified input stream, using specified encoding. * @param in the input stream to wrap * @param charset the input stream to wrap * @return a reader for this input stream */ public static Reader getInputStreamReader(InputStream in, String charset) { try { return new InputStreamReader(in, charset); } catch (UnsupportedEncodingException ex) { throw new RuntimeException(ex); // shouldn't happen since UTF-8 is supported by all JVMs per spec } } }