public final class HtmlInputStreamReader extends java.io.Reader implements ByteReadable, org.xml.sax.Locator
Reader
. Instead, it is the minimal implementation that does
what Tokenizer
needs while being an instance of
Reader
.
The only reason why this is a public class is that it needs to be visible to
test code in another package.Modifier and Type | Field and Description |
---|---|
private byte[] |
byteArray |
private java.nio.ByteBuffer |
byteBuffer |
private int |
bytesRead |
private boolean |
charsetBoundaryPassed |
private int |
col |
private java.nio.charset.CharsetDecoder |
decoder |
private Driver |
driver |
private boolean |
eofSeen |
private org.xml.sax.ErrorHandler |
errorHandler |
private boolean |
flushing |
private boolean |
hasPendingReplacementCharacter |
private java.io.InputStream |
inputStream |
private int |
limit |
private int |
line |
private int |
lineColPos |
private boolean |
needToNotifyTokenizer |
private boolean |
nextCharOnNewLine |
private int |
position |
private boolean |
prevWasCR |
private boolean |
shouldReadBytes |
private boolean |
sniffing |
private static int |
SNIFFING_LIMIT |
private Tokenizer |
tokenizer |
Constructor and Description |
---|
HtmlInputStreamReader(java.io.InputStream inputStream,
org.xml.sax.ErrorHandler errorHandler,
Tokenizer tokenizer,
Driver driver,
Encoding encoding) |
HtmlInputStreamReader(java.io.InputStream inputStream,
org.xml.sax.ErrorHandler errorHandler,
Tokenizer tokenizer,
Driver driver,
Heuristics heuristics) |
Modifier and Type | Method and Description |
---|---|
private void |
calculateLineAndCol(java.nio.CharBuffer charBuffer) |
void |
close() |
private void |
err(java.lang.String message) |
java.nio.charset.Charset |
getCharset() |
int |
getColumnNumber() |
int |
getLineNumber() |
java.lang.String |
getPublicId() |
java.lang.String |
getSystemId() |
private void |
initDecoder() |
static void |
main(java.lang.String[] args) |
int |
read() |
int |
read(char[] charArray) |
int |
read(char[] cbuf,
int off,
int len) |
int |
read(java.nio.CharBuffer target) |
int |
readByte()
Returns the value of the next byte as an integer from 0 to 0xFF or -1 if
the stream has ended.
|
void |
switchEncoding(Encoding newEnc) |
private static final int SNIFFING_LIMIT
private final java.io.InputStream inputStream
private final org.xml.sax.ErrorHandler errorHandler
private final Tokenizer tokenizer
private final Driver driver
private java.nio.charset.CharsetDecoder decoder
private boolean sniffing
private int limit
private int position
private int bytesRead
private boolean eofSeen
private boolean shouldReadBytes
private boolean charsetBoundaryPassed
private final byte[] byteArray
private final java.nio.ByteBuffer byteBuffer
private boolean needToNotifyTokenizer
private boolean flushing
private int line
private int col
private int lineColPos
private boolean hasPendingReplacementCharacter
private boolean nextCharOnNewLine
private boolean prevWasCR
public HtmlInputStreamReader(java.io.InputStream inputStream, org.xml.sax.ErrorHandler errorHandler, Tokenizer tokenizer, Driver driver, Heuristics heuristics) throws org.xml.sax.SAXException, java.io.IOException
inputStream
- errorHandler
- locator
- java.io.IOException
org.xml.sax.SAXException
private void initDecoder()
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[] charArray) throws java.io.IOException
read
in class java.io.Reader
java.io.IOException
private void calculateLineAndCol(java.nio.CharBuffer charBuffer)
public int readByte() throws java.io.IOException
ByteReadable
readByte
in interface ByteReadable
java.io.IOException
public static void main(java.lang.String[] args)
public int getColumnNumber()
getColumnNumber
in interface org.xml.sax.Locator
public int getLineNumber()
getLineNumber
in interface org.xml.sax.Locator
public java.lang.String getPublicId()
getPublicId
in interface org.xml.sax.Locator
public java.lang.String getSystemId()
getSystemId
in interface org.xml.sax.Locator
private void err(java.lang.String message) throws java.io.IOException
string
- org.xml.sax.SAXException
java.io.IOException
public java.nio.charset.Charset getCharset()
public int read() throws java.io.IOException
read
in class java.io.Reader
java.io.IOException
Reader.read()
public int read(char[] cbuf, int off, int len) throws java.io.IOException
read
in class java.io.Reader
java.io.IOException
Reader.read(char[], int, int)
public int read(java.nio.CharBuffer target) throws java.io.IOException
read
in interface java.lang.Readable
read
in class java.io.Reader
java.io.IOException
Reader.read(java.nio.CharBuffer)
public void switchEncoding(Encoding newEnc)