|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.io.InputStream
net.sf.mmm.util.xml.base.XmlInputStream
final class XmlInputStream
This class is an input-stream that detects the encoding from the potential XML-header of a stream.
| Field Summary | |
|---|---|
private byte[] |
buffer
The buffer read to lookahead the encoding from the XML header. |
private Charset |
charset
The encoding detected from the XML header or null if it was
NOT specified. |
private InputStream |
delegate
The original input-stream to adapt. |
private int |
index
The current index position in the buffer. |
private int |
length
the length of the buffered data (may be less than the array length). |
private static byte[] |
XML_ENCODING_ATRIBUTE
the start of the XML encoding attribute ( "encoding="). |
private static byte[] |
XML_HEADER_START
the start of the XML header ( " |
| Constructor Summary | |
|---|---|
XmlInputStream(InputStream delegate,
Charset defaultCharset)
The constructor. |
|
| Method Summary | |
|---|---|
void |
close()
|
Charset |
getCharset()
This method gets the Charset that was detected. |
int |
read()
|
int |
read(byte[] b,
int off,
int len)
|
| Methods inherited from class java.io.InputStream |
|---|
available, mark, markSupported, read, reset, skip |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final byte[] XML_HEADER_START
").
private static final byte[] XML_ENCODING_ATRIBUTE
"encoding=").
private final InputStream delegate
private final byte[] buffer
private final int length
private int index
buffer.
private Charset charset
null if it was
NOT specified.
| Constructor Detail |
|---|
public XmlInputStream(InputStream delegate,
Charset defaultCharset)
throws IOException
delegate - is the input-stream to adapt.defaultCharset - is the Charset used if NO encoding was
specified via an XML header.
IOException - if an I/O error was caused by delegate
when trying to read the XML header.| Method Detail |
|---|
public Charset getCharset()
Charset that was detected.
public int read()
throws IOException
read in class InputStreamIOException
public int read(byte[] b,
int off,
int len)
throws IOException
read in class InputStreamIOException
public void close()
throws IOException
close in interface Closeableclose in class InputStreamIOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||