< prev index next >
src/jdk.xml.bind/share/classes/com/sun/xml/internal/dtdparser/XmlReader.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 31,40 ****
--- 31,41 ----
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PushbackInputStream;
import java.io.Reader;
import java.util.Hashtable;
+ import java.util.Locale;
// NOTE: Add I18N support to this class when JDK gets the ability to
// defer selection of locale for exception messages ... use the same
// technique for both.
*** 84,94 ****
// between here and the real data source, and larger buffers keep
// that from slowing you down.)
//
/**
! * Constructs the reader from an input stream, autodetecting
* the encoding to use according to the heuristic specified
* in the XML 1.0 recommendation.
*
* @param in the input stream from which the reader is constructed
* @throws IOException on error, such as unrecognized encoding
--- 85,95 ----
// between here and the real data source, and larger buffers keep
// that from slowing you down.)
//
/**
! * Constructs the reader from an input stream, auto-detecting
* the encoding to use according to the heuristic specified
* in the XML 1.0 recommendation.
*
* @param in the input stream from which the reader is constructed
* @throws IOException on error, such as unrecognized encoding
*** 102,112 ****
* from standard encoding names to ones that understood by
* Java where necessary.
*
* @param in the input stream from which the reader is constructed
* @param encoding the IETF standard name of the encoding to use;
! * if null, autodetection is used.
* @throws IOException on error, including unrecognized encoding
*/
public static Reader createReader(InputStream in, String encoding)
throws IOException {
if (encoding == null)
--- 103,113 ----
* from standard encoding names to ones that understood by
* Java where necessary.
*
* @param in the input stream from which the reader is constructed
* @param encoding the IETF standard name of the encoding to use;
! * if null, auto-detection is used.
* @throws IOException on error, including unrecognized encoding
*/
public static Reader createReader(InputStream in, String encoding)
throws IOException {
if (encoding == null)
*** 176,186 ****
}
// returns an encoding name supported by JDK >= 1.1.6
// for some cases required by the XML spec
private static String std2java(String encoding) {
! String temp = encoding.toUpperCase();
temp = (String) charsets.get(temp);
return temp != null ? temp : encoding;
}
/**
--- 177,187 ----
}
// returns an encoding name supported by JDK >= 1.1.6
// for some cases required by the XML spec
private static String std2java(String encoding) {
! String temp = encoding.toUpperCase(Locale.ENGLISH);
temp = (String) charsets.get(temp);
return temp != null ? temp : encoding;
}
/**
*** 319,329 ****
//
// Next must be "l" (and whitespace) else we conclude
// error and choose UTF-8.
//
! if ((c = r.read()) != 'l') {
setEncoding(pb, "UTF-8");
return;
}
//
--- 320,330 ----
//
// Next must be "l" (and whitespace) else we conclude
// error and choose UTF-8.
//
! if ((r.read()) != 'l') {
setEncoding(pb, "UTF-8");
return;
}
//
*** 756,765 ****
--- 757,767 ----
static final class Iso8859_1Reader extends BaseReader {
Iso8859_1Reader(InputStream in) {
super(in);
}
+ @Override
public int read(char buf [], int offset, int len) throws IOException {
int i;
if (instream == null)
return -1;
< prev index next >