| java.lang.Object java.io.Reader com.sun.xml.dtdparser.XmlReader
XmlReader | final class XmlReader extends Reader (Code) | | This handles several XML-related tasks that normal java.io Readers
don't support, inluding use of IETF standard encoding names and
automatic detection of most XML encodings. The former is needed
for interoperability; the latter is needed to conform with the XML
spec. This class also optimizes reading some common encodings by
providing low-overhead unsynchronized Reader support.
Note that the autodetection facility should be used only on
data streams which have an unknown character encoding. For example,
it should never be used on MIME text/xml entities.
Note that XML processors are only required to support UTF-8 and
UTF-16 character encodings. Autodetection permits the underlying Java
implementation to provide support for many other encodings, such as
US-ASCII, ISO-8859-5, Shift_JIS, EUC-JP, and ISO-2022-JP.
author: David Brownell author: Janet Koenig version: 1.3 00/02/24 |
Inner Class :abstract static class BaseReader extends Reader | |
Inner Class :final static class Utf8Reader extends BaseReader | |
Inner Class :final static class AsciiReader extends BaseReader | |
Inner Class :final static class Iso8859_1Reader extends BaseReader | |
Method Summary | |
public void | close() Closes the reader. | public static Reader | createReader(InputStream in) Constructs the reader from an input stream, autodetecting
the encoding to use according to the heuristic specified
in the XML 1.0 recommendation. | public static Reader | createReader(InputStream in, String encoding) Creates a reader supporting the given encoding, mapping
from standard encoding names to ones that understood by
Java where necessary. | public String | getEncoding() | public void | mark(int value) Sets a mark allowing a limited number of characters to
be "peeked", by reading and then resetting. | public boolean | markSupported() Returns true iff the reader supports mark/reset. | public int | read(char buf, int off, int len) Reads the number of characters read into the buffer, or -1 on EOF. | public int | read() Reads a single character. | public boolean | ready() Returns true iff input characters are known to be ready. | public void | reset() Resets the current position to the last marked position. | public long | skip(long value) Skips a specified number of characters. |
createReader | public static Reader createReader(InputStream in) throws IOException(Code) | | Constructs the reader from an input stream, autodetecting
the encoding to use according to the heuristic specified
in the XML 1.0 recommendation.
Parameters: in - the input stream from which the reader is constructed throws: IOException - on error, such as unrecognized encoding |
createReader | public static Reader createReader(InputStream in, String encoding) throws IOException(Code) | | Creates a reader supporting the given encoding, mapping
from standard encoding names to ones that understood by
Java where necessary.
Parameters: in - the input stream from which the reader is constructed Parameters: encoding - the IETF standard name of the encoding to use;if null, autodetection is used. throws: IOException - on error, including unrecognized encoding |
getEncoding | public String getEncoding()(Code) | | Returns the standard name of the encoding in use
|
mark | public void mark(int value) throws IOException(Code) | | Sets a mark allowing a limited number of characters to
be "peeked", by reading and then resetting.
Parameters: value - how many characters may be "peeked". |
markSupported | public boolean markSupported()(Code) | | Returns true iff the reader supports mark/reset.
|
read | public int read(char buf, int off, int len) throws IOException(Code) | | Reads the number of characters read into the buffer, or -1 on EOF.
|
ready | public boolean ready() throws IOException(Code) | | Returns true iff input characters are known to be ready.
|
reset | public void reset() throws IOException(Code) | | Resets the current position to the last marked position.
|
skip | public long skip(long value) throws IOException(Code) | | Skips a specified number of characters.
|
|
|