code: public static StreamDecoder forInputStreamReader(InputStream in,
                                                       Object lock,
                                                       String charsetName)
          throws UnsupportedEncodingException
      {
          String csn = charsetName;
          if (csn == null)
              csn = Charset.defaultCharset().name();
          try {
              if (Charset.isSupported(csn))
                  return new StreamDecoder(in, lock, Charset.forName(csn));
          } catch (IllegalCharsetNameException x) { }
          throw new UnsupportedEncodingException (csn);
      }
docs: Factories for java.io.InputStreamReader