Package 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.AutoCloseable,java.lang.Readable
public final class XmlReader extends java.io.ReaderThis 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
-
-
Constructor Summary
Constructors Constructor Description XmlReader(java.io.InputStream inputStream, java.lang.String defaultEncoding)Construct.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()java.lang.StringgetEncoding()Return the encoding used while reading the markup file.voidinit()Reads and parses markup from a resource such as file.intread(char[] buf, int from, int to)java.lang.StringtoString()
-
-
-
Constructor Detail
-
XmlReader
public XmlReader(java.io.InputStream inputStream, java.lang.String defaultEncoding) throws java.io.IOExceptionConstruct.- 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
-
-
Method Detail
-
getEncoding
public final java.lang.String getEncoding()
Return the encoding used while reading the markup file.- Returns:
- if null, then JVM default
-
init
public void init() throws java.io.IOExceptionReads and parses markup from a resource such as file.- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein classjava.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:
readin classjava.io.Reader- Throws:
java.io.IOException- See Also:
Reader.read(char[], int, int)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object- Returns:
- The markup to be parsed
-
-