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
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 String getEncoding()
- Return the encoding used while reading the markup file.
- Returns:
- if null, then JVM default
getXmlDeclaration
public String getXmlDeclaration()
- Return the XML declaration string, in case if found in the markup.
- Returns:
- Null, if not found.
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 © 2004-2011 Apache Software Foundation. All Rights Reserved.