boolean bool1 = XMLChar.isValidIANAEncoding(paramString);
boolean bool2 = XMLChar.isValidJavaEncoding(paramString);
if ((!bool1) || ((this.fAllowJavaEncodings) && (!bool2)))
{
this.fErrorReporter.reportError("http://www.w3.org/TR/1998/REC-xml-19980210", "EncodingDeclInvalid", new Object[] { paramString }, 2);
return new Latin1Reader(paramInputStream, this.fBufferSize);
}
String str2 = EncodingMap.getIANA2JavaMapping(str1);
if (str2 == null)
{
if (this.fAllowJavaEncodings)
{
str2 = paramString;
}
else
{
this.fErrorReporter.reportError("http://www.w3.org/TR/1998/REC-xml-19980210", "EncodingDeclInvalid", new Object[] { paramString }, 2);
if (this.fTempByteBuffer == null)
this.fTempByteBuffer = this.fByteBufferPool.getBuffer();
return new Latin1Reader(paramInputStream, this.fTempByteBuffer);
}
}
else
{
if (str2.equals("ASCII"))
{
if (this.fTempByteBuffer == null)
this.fTempByteBuffer = this.fByteBufferPool.getBuffer();
return new ASCIIReader(paramInputStream, this.fTempByteBuffer, this.fErrorReporter.getMessageFormatter("http://www.w3.org/TR/1998/REC-xml-19980210"), this.fErrorReporter.getLocale());
}
if (str2.equals("ISO8859_1"))
{
if (this.fTempByteBuffer == null)
this.fTempByteBuffer = this.fByteBufferPool.getBuffer();
return new Latin1Reader(paramInputStream, this.fTempByteBuffer);
}
}
return new InputStreamReader(paramInputStream, str2);
}