public class HTMLReader
extends java.io.Reader
<META http-equiv="content-type" content="text/html; charset=...">
and a value from XML header (in case there is one)
<?xml version="1.0" encoding="..."?>
. If encoding isn't
specified, or it is not supported by Java platform, the file is opened in
encoding passed to constructor or default system encoding (ISO-8859-2 in USA,
Windows-1251 on my OS).Constructor and Description |
---|
HTMLReader(java.lang.String fileName,
java.lang.String encoding)
Creates a new instance of HTMLReader.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
java.lang.String |
getEncoding()
Returns encoding that was used to read the HTML file.
|
int |
read(char[] cbuf,
int off,
int len) |
public HTMLReader(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 java.lang.String getEncoding()
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