nu.validator.htmlparser.impl
Class HtmlInputStreamReader
java.lang.Object
java.io.Reader
nu.validator.htmlparser.impl.HtmlInputStreamReader
- All Implemented Interfaces:
- Closeable, Readable, ByteReadable, Locator
public final class HtmlInputStreamReader
- extends Reader
- implements ByteReadable, Locator
Be very careful with this class. It is not a general-purpose subclass of of
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.
- Version:
- $Id: HtmlInputStreamReader.java 150 2007-08-16 19:21:25Z hsivonen $
- Author:
- hsivonen
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SNIFFING_LIMIT
private static final int SNIFFING_LIMIT
- See Also:
- Constant Field Values
inputStream
private final InputStream inputStream
errorHandler
private final ErrorHandler errorHandler
locator
private final Locator locator
tokenizer
private final Tokenizer tokenizer
decoder
private CharsetDecoder decoder
sniffing
private boolean sniffing
limit
private int limit
position
private int position
bytesRead
private int bytesRead
eofSeen
private boolean eofSeen
shouldReadBytes
private boolean shouldReadBytes
charsetBoundaryPassed
private boolean charsetBoundaryPassed
byteArray
private final byte[] byteArray
byteBuffer
private final ByteBuffer byteBuffer
needToNotifyTokenizer
private boolean needToNotifyTokenizer
flushing
private boolean flushing
line
private int line
col
private int col
lineColPos
private int lineColPos
HtmlInputStreamReader
public HtmlInputStreamReader(InputStream inputStream,
ErrorHandler errorHandler,
Locator locator,
Tokenizer tokenizer)
throws SAXException,
IOException
- Parameters:
inputStream
- errorHandler
- locator
-
- Throws:
IOException
SAXException
HtmlInputStreamReader
public HtmlInputStreamReader(InputStream inputStream,
ErrorHandler errorHandler,
Locator locator,
Tokenizer tokenizer,
CharsetDecoder decoder)
throws SAXException,
IOException
- Throws:
SAXException
IOException
initDecoder
private void initDecoder()
close
public void close()
throws IOException
- Specified by:
close
in interface Closeable
- Specified by:
close
in class Reader
- Throws:
IOException
read
public int read(char[] charArray)
throws IOException
- Overrides:
read
in class Reader
- Throws:
IOException
calculateLineAndCol
private void calculateLineAndCol(CharBuffer charBuffer)
readByte
public int readByte()
throws IOException
- Specified by:
readByte
in interface ByteReadable
- Throws:
IOException
main
public static void main(String[] args)
getColumnNumber
public int getColumnNumber()
- Specified by:
getColumnNumber
in interface Locator
getLineNumber
public int getLineNumber()
- Specified by:
getLineNumber
in interface Locator
getPublicId
public String getPublicId()
- Specified by:
getPublicId
in interface Locator
getSystemId
public String getSystemId()
- Specified by:
getSystemId
in interface Locator
err
private void err(String message)
throws IOException
- Parameters:
string
-
- Throws:
SAXException
IOException
warn
private void warn(String message)
throws IOException
- Parameters:
string
-
- Throws:
SAXException
IOException
getCharset
public Charset getCharset()
read
public int read()
throws IOException
- Overrides:
read
in class Reader
- Throws:
IOException
- See Also:
Reader.read()
read
public int read(char[] cbuf,
int off,
int len)
throws IOException
- Specified by:
read
in class Reader
- Throws:
IOException
- See Also:
Reader.read(char[], int, int)
read
public int read(CharBuffer target)
throws IOException
- Specified by:
read
in interface Readable
- Overrides:
read
in class Reader
- Throws:
IOException
- See Also:
Reader.read(java.nio.CharBuffer)