public class XMLReader
extends java.io.Reader
Detecting of encoding is done by reading a value from XML header
<?xml version="1.0" encoding="..."?>
If encoding isn't specified, or it is not supported by Java platform, the file is opened in default system encoding (ISO-8859-2 in USA, Windows-1251 on my OS).
Constructor and Description |
---|
XMLReader(java.io.InputStream inputStream,
java.lang.String encoding) |
XMLReader(java.lang.String fileName)
Creates a new instance of XMLReader.
|
XMLReader(java.lang.String fileName,
java.lang.String encoding)
Creates a new instance of XMLReader.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
int |
read(char[] cbuf,
int off,
int len) |
public XMLReader(java.lang.String fileName) throws java.io.IOException
fileName
- - the file to readjava.io.IOException
public XMLReader(java.lang.String fileName, java.lang.String encoding) throws java.io.IOException
encoding
, or (if supplied null, or
supplied encoding is not supported by JVM) falls back to default encoding
of Operating System.fileName
- The file to read.encoding
- The encoding to use if we can't autodetect.java.io.IOException
public XMLReader(java.io.InputStream inputStream, java.lang.String encoding) throws java.io.IOException
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.Reader
java.io.IOException
public int read(char[] cbuf, int off, int len) throws java.io.IOException
read
in class java.io.Reader
java.io.IOException