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.
| Modifier and Type | Class and Description |
|---|---|
| pack-priv static class | |
| pack-priv abstract static class | |
| pack-priv static class | |
| pack-priv static class |
| Modifier and Type | Field and Description |
|---|---|
| private String | |
| private static final HashMap | |
| private boolean | |
| private Reader | |
| private static final int |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public void | close()
Implements abstract java. Implements java. |
| public static Reader | createReader(InputStream
the input stream from which the reader is constructed 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
the input stream from which the reader is constructed in, String the IETF standard name of the encoding to use;
if null, autodetection is used. encoding)Creates a reader supporting the given encoding, mapping from standard encoding names to ones that understood by Java where necessary. |
| public String | |
| public void | mark(int
how many characters may be "peeked". value)Overrides java. |
| public boolean | markSupported()
Overrides java. |
| public int | read(char[]
Destination buffer buf, int Offset at which to start storing characters off, int Maximum number of characters to read len)Implements abstract java. |
| public int | |
| public boolean | |
| public void | |
| private void | |
| public long | skip(long
The number of characters to skip value)Overrides java. |
| private static String | |
| private void |
| assignedEncoding | back to summary |
|---|---|
| private String assignedEncoding | |
| charsets | back to summary |
|---|---|
| private static final HashMap<String, String> charsets | |
| closed | back to summary |
|---|---|
| private boolean closed | |
| in | back to summary |
|---|---|
| private Reader in | |
| MAXPUSHBACK | back to summary |
|---|---|
| private static final int MAXPUSHBACK | |
| XmlReader | back to summary |
|---|---|
| private XmlReader(InputStream stream) throws IOException | |
| close | back to summary |
|---|---|
| public void close() throws IOException Implements abstract java. Implements java. Closes the reader.
| |
| createReader | back to summary |
|---|---|
| public static Reader createReader(InputStream in) throws IOException Constructs the reader from an input stream, autodetecting the encoding to use according to the heuristic specified in the XML 1.0 recommendation.
| |
| createReader | back to summary |
|---|---|
| public static Reader createReader(InputStream in, String encoding) throws IOException Creates a reader supporting the given encoding, mapping from standard encoding names to ones that understood by Java where necessary.
| |
| getEncoding | back to summary |
|---|---|
| public String getEncoding() Returns the standard name of the encoding in use | |
| mark | back to summary |
|---|---|
| public void mark(int value) throws IOException Overrides java. Sets a mark allowing a limited number of characters to be "peeked", by reading and then resetting.
| |
| markSupported | back to summary |
|---|---|
| public boolean markSupported() Overrides java. Returns true iff the reader supports mark/reset.
| |
| read | back to summary |
|---|---|
| public int read(char[] buf, int off, int len) throws IOException Implements abstract java. Reads the number of characters read into the buffer, or -1 on EOF.
| |
| read | back to summary |
|---|---|
| public int read() throws IOException Overrides java. Reads a single character.
| |
| ready | back to summary |
|---|---|
| public boolean ready() throws IOException Overrides java. Returns true iff input characters are known to be ready.
| |
| reset | back to summary |
|---|---|
| public void reset() throws IOException Overrides java. Resets the current position to the last marked position.
| |
| setEncoding | back to summary |
|---|---|
| private void setEncoding(InputStream stream, String encoding) throws IOException | |
| skip | back to summary |
|---|---|
| public long skip(long value) throws IOException Overrides java. Skips a specified number of characters.
| |
| std2java | back to summary |
|---|---|
| private static String std2java(String encoding) | |
| useEncodingDecl | back to summary |
|---|---|
| private void useEncodingDecl(PushbackInputStream pb, String encoding) throws IOException | |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public int | read(char[]
Destination buffer buf, int Offset at which to start storing characters offset, int Maximum number of characters to read len)Implements abstract java. |
| AsciiReader | back to summary |
|---|---|
| pack-priv AsciiReader(InputStream in) | |
| read | back to summary |
|---|---|
| public int read(char[] buf, int offset, int len) throws IOException Implements abstract java. Doc from java. Reads characters into a portion of an array. This method will block until some input is available, an I/O error occurs, or the end of the stream is reached. If
| |
| Modifier and Type | Field and Description |
|---|---|
| protected byte[] | |
| protected int | |
| protected InputStream | |
| protected int |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public void | close()
Implements abstract java. Implements java. |
| public boolean |
| buffer | back to summary |
|---|---|
| protected byte[] buffer | |
| finish | back to summary |
|---|---|
| protected int finish | |
| instream | back to summary |
|---|---|
| protected InputStream instream | |
| start | back to summary |
|---|---|
| protected int start | |
| BaseReader | back to summary |
|---|---|
| pack-priv BaseReader(InputStream stream) | |
| close | back to summary |
|---|---|
| public void close() throws IOException Implements abstract java. Implements java. Doc from java. Closes the stream and releases any system resources associated with it. Once the stream has been closed, further read(), ready(), mark(), reset(), or skip() invocations will throw an IOException. Closing a previously closed stream has no effect.
| |
| ready | back to summary |
|---|---|
| public boolean ready() throws IOException Overrides java. Doc from java. Tells whether this stream is ready to be read.
| |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public int | read(char[]
Destination buffer buf, int Offset at which to start storing characters offset, int Maximum number of characters to read len)Implements abstract java. |
| Iso8859_1Reader | back to summary |
|---|---|
| pack-priv Iso8859_1Reader(InputStream in) | |
| read | back to summary |
|---|---|
| public int read(char[] buf, int offset, int len) throws IOException Implements abstract java. Doc from java. Reads characters into a portion of an array. This method will block until some input is available, an I/O error occurs, or the end of the stream is reached. If
| |
| Modifier and Type | Field and Description |
|---|---|
| private char |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public int | read(char[]
Destination buffer buf, int Offset at which to start storing characters offset, int Maximum number of characters to read len)Implements abstract java. |
| nextChar | back to summary |
|---|---|
| private char nextChar | |
| Utf8Reader | back to summary |
|---|---|
| pack-priv Utf8Reader(InputStream stream) | |
| read | back to summary |
|---|---|
| public int read(char[] buf, int offset, int len) throws IOException Implements abstract java. Doc from java. Reads characters into a portion of an array. This method will block until some input is available, an I/O error occurs, or the end of the stream is reached. If
| |