Package nu.validator.htmlparser.io
Class HtmlInputStreamReader
java.lang.Object
java.io.Reader
nu.validator.htmlparser.io.HtmlInputStreamReader
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,java.lang.Readable
,ByteReadable
,org.xml.sax.ext.Locator2
,org.xml.sax.Locator
public final class HtmlInputStreamReader extends java.io.Reader implements ByteReadable, org.xml.sax.Locator, org.xml.sax.ext.Locator2
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$
- Author:
- hsivonen
-
Field Summary
-
Constructor Summary
Constructors Constructor Description HtmlInputStreamReader(java.io.InputStream inputStream, org.xml.sax.ErrorHandler errorHandler, Tokenizer tokenizer, Driver driver, Heuristics heuristics)
HtmlInputStreamReader(java.io.InputStream inputStream, org.xml.sax.ErrorHandler errorHandler, Tokenizer tokenizer, Driver driver, Encoding encoding)
-
Method Summary
Modifier and Type Method Description void
close()
java.nio.charset.Charset
getCharset()
int
getColumnNumber()
java.lang.String
getEncoding()
int
getLineNumber()
java.lang.String
getPublicId()
java.lang.String
getSystemId()
java.lang.String
getXMLVersion()
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)
-
Constructor Details
-
HtmlInputStreamReader
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- Parameters:
inputStream
-errorHandler
-locator
-- Throws:
java.io.IOException
org.xml.sax.SAXException
-
HtmlInputStreamReader
public HtmlInputStreamReader(java.io.InputStream inputStream, org.xml.sax.ErrorHandler errorHandler, Tokenizer tokenizer, Driver driver, Encoding encoding) throws org.xml.sax.SAXException, java.io.IOException- Throws:
org.xml.sax.SAXException
java.io.IOException
-
-
Method Details
-
close
public void close() throws java.io.IOException- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Specified by:
close
in classjava.io.Reader
- Throws:
java.io.IOException
-
read
public int read(char[] charArray) throws java.io.IOException- Overrides:
read
in classjava.io.Reader
- Throws:
java.io.IOException
-
readByte
public int readByte() throws java.io.IOExceptionDescription copied from interface:ByteReadable
Returns the value of the next byte as an integer from 0 to 0xFF or -1 if the stream has ended.- Specified by:
readByte
in interfaceByteReadable
- Returns:
- integer from 0 to 0xFF or -1 on EOF
- Throws:
java.io.IOException
-
main
public static void main(java.lang.String[] args) -
getColumnNumber
public int getColumnNumber()- Specified by:
getColumnNumber
in interfaceorg.xml.sax.Locator
-
getLineNumber
public int getLineNumber()- Specified by:
getLineNumber
in interfaceorg.xml.sax.Locator
-
getPublicId
public java.lang.String getPublicId()- Specified by:
getPublicId
in interfaceorg.xml.sax.Locator
-
getSystemId
public java.lang.String getSystemId()- Specified by:
getSystemId
in interfaceorg.xml.sax.Locator
-
getXMLVersion
public java.lang.String getXMLVersion()- Specified by:
getXMLVersion
in interfaceorg.xml.sax.ext.Locator2
-
getEncoding
public java.lang.String getEncoding()- Specified by:
getEncoding
in interfaceorg.xml.sax.ext.Locator2
-
getCharset
public java.nio.charset.Charset getCharset() -
read
public int read() throws java.io.IOException- Overrides:
read
in classjava.io.Reader
- Throws:
java.io.IOException
- See Also:
Reader.read()
-
read
public int read(char[] cbuf, int off, int len) throws java.io.IOException- Specified by:
read
in classjava.io.Reader
- Throws:
java.io.IOException
- See Also:
Reader.read(char[], int, int)
-
read
public int read(java.nio.CharBuffer target) throws java.io.IOException- Specified by:
read
in interfacejava.lang.Readable
- Overrides:
read
in classjava.io.Reader
- Throws:
java.io.IOException
- See Also:
Reader.read(java.nio.CharBuffer)
-
switchEncoding
-