// important when continue-after-fatal-error is turned
// on. -Ac
if (DEBUG_ENCODINGS) {
System.out.println("$$$ creating Latin1Reader");
}
return new Latin1Reader(inputStream, fBufferSize);
}
// try to use a Java reader
String javaEncoding = EncodingMap.getIANA2JavaMapping(ENCODING);
if (javaEncoding == null) {
if (fAllowJavaEncodings) {
javaEncoding = encoding;
}
else {
fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
"EncodingDeclInvalid",
new Object[] { encoding },
XMLErrorReporter.SEVERITY_FATAL_ERROR);
// see comment above.
if (DEBUG_ENCODINGS) {
System.out.println("$$$ creating Latin1Reader");
}
if (fTempByteBuffer == null) {
fTempByteBuffer = fByteBufferPool.getBuffer();
}
return new Latin1Reader(inputStream, fTempByteBuffer);
}
}
else if (javaEncoding.equals("ASCII")) {
if (DEBUG_ENCODINGS) {
System.out.println("$$$ creating ASCIIReader");
}
if (fTempByteBuffer == null) {
fTempByteBuffer = fByteBufferPool.getBuffer();
}
return new ASCIIReader(inputStream, fTempByteBuffer, fErrorReporter.getMessageFormatter(XMLMessageFormatter.XML_DOMAIN), fErrorReporter.getLocale());
}
else if (javaEncoding.equals("ISO8859_1")) {
if (DEBUG_ENCODINGS) {
System.out.println("$$$ creating Latin1Reader");
}
if (fTempByteBuffer == null) {
fTempByteBuffer = fByteBufferPool.getBuffer();
}
return new Latin1Reader(inputStream, fTempByteBuffer);
}
if (DEBUG_ENCODINGS) {
System.out.print("$$$ creating Java InputStreamReader: encoding="+javaEncoding);
if (javaEncoding == encoding) {
System.out.print(" (IANA encoding)");