org.apache.wicket.util.io
Class XmlReader
java.lang.Object
java.io.Reader
org.apache.wicket.util.io.XmlReader
- All Implemented Interfaces:
- Closeable, Readable
public final class XmlReader
- extends 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
Method Summary |
void |
close()
|
String |
getEncoding()
Return the encoding used while reading the markup file. |
void |
init()
Reads and parses markup from a resource such as file. |
int |
read(char[] buf,
int from,
int to)
|
String |
toString()
|
XmlReader
public XmlReader(InputStream inputStream,
String defaultEncoding)
throws 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:
IOException
- In case something went wrong while reading the data
getEncoding
public final String getEncoding()
- Return the encoding used while reading the markup file.
- Returns:
- if null, then JVM default
init
public void init()
throws IOException
- Reads and parses markup from a resource such as file.
- Throws:
IOException
close
public void close()
throws IOException
- Specified by:
close
in interface Closeable
- Specified by:
close
in class Reader
- Throws:
IOException
- See Also:
Reader.close()
read
public int read(char[] buf,
int from,
int to)
throws IOException
- Specified by:
read
in class Reader
- Throws:
IOException
- See Also:
Reader.read(char[], int, int)
toString
public String toString()
- Overrides:
toString
in class Object
- Returns:
- The markup to be parsed
Copyright © 2006-2012 Apache Software Foundation. All Rights Reserved.