Package org.apache.wicket.util.io
Class XmlReader
- java.lang.Object
-
- java.io.Reader
-
- org.apache.wicket.util.io.XmlReader
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,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
-
-
Constructor Summary
Constructors Constructor Description XmlReader(InputStream inputStream, String defaultEncoding)
Construct.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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()
-
Methods inherited from class java.io.Reader
mark, markSupported, nullReader, read, read, read, ready, reset, skip, transferTo
-
-
-
-
Constructor Detail
-
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
-
-
Method Detail
-
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 interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in classReader
- Throws:
IOException
- See Also:
Reader.close()
-
read
public int read(char[] buf, int from, int to) throws IOException
- Specified by:
read
in classReader
- Throws:
IOException
- See Also:
Reader.read(char[], int, int)
-
-