code: public static Reader encodedInputStreamReader(InputStream stream, String encoding) throws IOException {
      // InputStreamReader doesn't allow encoding to be null;
      if (encoding == null) {
        return new InputStreamReader(stream);
      } else {
        return new InputStreamReader(stream, encoding);
      }
    }
docs: Create a Reader with an explicit encoding around an InputStream.
  This static method will treat null as meaning to use the platform default,
  unlike the Java library methods that disallow a null encoding.
  
  @param stream An InputStream
  @param encoding A charset encoding
  @return A Reader
  @throws IOException If any IO problem