private Reader createReader(InputStream inputStream,String encoding,Boolean isBigEndian) throws IOException, JasperException {
  if (encoding == null) {
    encoding="UTF-8";
  }
  String ENCODING=encoding.toUpperCase(Locale.ENGLISH);
  if (ENCODING.equals("UTF-8")) {
    return new UTF8Reader(inputStream,fBufferSize);
  }
  if (ENCODING.equals("US-ASCII")) {
    return new ASCIIReader(inputStream,fBufferSize);
  }
  if (ENCODING.equals("ISO-10646-UCS-4")) {
    if (isBigEndian != null) {
      boolean isBE=isBigEndian.booleanValue();
      if (isBE) {
        return new UCSReader(inputStream,UCSReader.UCS4BE);
      }
 else {
        return new UCSReader(inputStream,UCSReader.UCS4LE);
      }
    }
 else {
      err.jspError("jsp.error.xml.encodingByteOrderUnsupported",encoding);
    }
  }
  if (ENCODING.equals("ISO-10646-UCS-2")) {
    if (isBigEndian != null) {
      boolean isBE=isBigEndian.booleanValue();
      if (isBE) {
        return new UCSReader(inputStream,UCSReader.UCS2BE);
      }
 else {
        return new UCSReader(inputStream,UCSReader.UCS2LE);
      }
    }
 else {
      err.jspError("jsp.error.xml.encodingByteOrderUnsupported",encoding);
    }
  }
  boolean validIANA=XMLChar.isValidIANAEncoding(encoding);
  boolean validJava=XMLChar.isValidJavaEncoding(encoding);
  if (!validIANA || (fAllowJavaEncodings && !validJava)) {
    err.jspError("jsp.error.xml.encodingDeclInvalid",encoding);
    encoding="ISO-8859-1";
  }
  String javaEncoding=EncodingMap.getIANA2JavaMapping(ENCODING);
  if (javaEncoding == null) {
    if (fAllowJavaEncodings) {
      javaEncoding=encoding;
    }
 else {
      err.jspError("jsp.error.xml.encodingDeclInvalid",encoding);
      javaEncoding="ISO8859_1";
    }
  }
  return new InputStreamReader(inputStream,javaEncoding);
}

private Reader createReader ( InputStream inputStream , String encoding , Boolean isBigEndian ) throws IOException , JasperException { if ( encoding == null ) { encoding = "UTF-8" ; } String ENCODING = encoding . toUpperCase ( Locale . ENGLISH ) ; if ( ENCODING . equals ( "UTF-8" ) ) { return new UTF8Reader ( inputStream , fBufferSize ) ; } if ( ENCODING . equals ( "US-ASCII" ) ) { return new ASCIIReader ( inputStream , fBufferSize ) ; } if ( ENCODING . equals ( "ISO-10646-UCS-4" ) ) { if ( isBigEndian != null ) { boolean isBE = isBigEndian . booleanValue ( ) ; if ( isBE ) { return new UCSReader ( inputStream , UCSReader . UCS4BE ) ; } else { return new UCSReader ( inputStream , UCSReader . UCS4LE ) ; } } else { err . jspError ( "jsp.error.xml.encodingByteOrderUnsupported" , encoding ) ; } } if ( ENCODING . equals ( "ISO-10646-UCS-2" ) ) { if ( isBigEndian != null ) { boolean isBE = isBigEndian . booleanValue ( ) ; if ( isBE ) { return new UCSReader ( inputStream , UCSReader . UCS2BE ) ; } else { return new UCSReader ( inputStream , UCSReader . UCS2LE ) ; } } else { err . jspError ( "jsp.error.xml.encodingByteOrderUnsupported" , encoding ) ; } } boolean validIANA = XMLChar . isValidIANAEncoding ( encoding ) ; boolean validJava = XMLChar . isValidJavaEncoding ( encoding ) ; if ( ! validIANA || ( fAllowJavaEncodings && ! validJava ) ) { err . jspError ( "jsp.error.xml.encodingDeclInvalid" , encoding ) ; encoding = "ISO-8859-1" ; } String javaEncoding = EncodingMap . getIANA2JavaMapping ( ENCODING ) ; if ( javaEncoding == null ) { if ( fAllowJavaEncodings ) { javaEncoding = encoding ; } else { err . jspError ( "jsp.error.xml.encodingDeclInvalid" , encoding ) ; javaEncoding = "ISO8859_1" ; } } return new InputStreamReader ( inputStream , javaEncoding ) ; }
creates a reader capable of reading the given input stream in the specified encoding .
