org.apache.wicket.util.io
Class XmlReader
java.lang.Object
java.io.Reader
org.apache.wicket.util.io.XmlReader
- All Implemented Interfaces:
- java.io.Closeable, java.lang.Readable
public final class XmlReader
- extends java.io.Reader
This is a simple XmlReader. Its only purpose is to read the xml decl string from the input and
apply proper character encoding to all subsequent characters. The xml decl string itself is
removed from the output.
- Author:
- Juergen Donnerstag
Fields inherited from class java.io.Reader |
lock |
Constructor Summary |
XmlReader(java.io.InputStream inputStream,
java.lang.String defaultEncoding)
Construct. |
Method Summary |
void |
close()
|
java.lang.String |
getEncoding()
Return the encoding used while reading the markup file. |
java.lang.String |
getXmlDeclaration()
Return the XML declaration string, in case if found in the markup. |
void |
init()
Reads and parses markup from a resource such as file. |
int |
read(char[] buf,
int from,
int to)
|
java.lang.String |
toString()
|
Methods inherited from class java.io.Reader |
mark, markSupported, read, read, read, ready, reset, skip |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
XmlReader
public XmlReader(java.io.InputStream inputStream,
java.lang.String defaultEncoding)
throws java.io.IOException
- Construct.
- Parameters:
inputStream
- The InputStream to read the xml data fromdefaultEncoding
- Default character encoding to use when not specified in XML declaration, specify
null to use JVM default
- Throws:
java.io.IOException
- In case something went wrong while reading the data
getEncoding
public java.lang.String getEncoding()
- Return the encoding used while reading the markup file.
- Returns:
- if null, then JVM default
getXmlDeclaration
public java.lang.String getXmlDeclaration()
- Return the XML declaration string, in case if found in the markup.
- Returns:
- Null, if not found.
init
public void init()
throws java.io.IOException
- Reads and parses markup from a resource such as file.
- Throws:
java.io.IOException
close
public void close()
throws java.io.IOException
- Specified by:
close
in interface java.io.Closeable
- Specified by:
close
in class java.io.Reader
- Throws:
java.io.IOException
- See Also:
Reader.close()
read
public int read(char[] buf,
int from,
int to)
throws java.io.IOException
- Specified by:
read
in class java.io.Reader
- Throws:
java.io.IOException
- See Also:
Reader.read(char[], int, int)
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
- Returns:
- The markup to be parsed
Copyright © 2004-2010 Apache Software Foundation. All Rights Reserved.