nu.validator.htmlparser.io
Class HtmlInputStreamReader

java.lang.Object
  extended by java.io.Reader
      extended by nu.validator.htmlparser.io.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$
Author:
hsivonen

Field Summary
 
Fields inherited from class java.io.Reader
lock
 
Constructor Summary
HtmlInputStreamReader(InputStream inputStream, ErrorHandler errorHandler, Tokenizer tokenizer, Driver driver, Encoding encoding)
           
HtmlInputStreamReader(InputStream inputStream, ErrorHandler errorHandler, Tokenizer tokenizer, Driver driver, Heuristics heuristics)
           
 
Method Summary
 void close()
           
 Charset getCharset()
           
 int getColumnNumber()
           
 int getLineNumber()
           
 String getPublicId()
           
 String getSystemId()
           
static void main(String[] args)
           
 int read()
           
 int read(char[] charArray)
           
 int read(char[] cbuf, int off, int len)
           
 int read(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)
           
 
Methods inherited from class java.io.Reader
mark, markSupported, ready, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HtmlInputStreamReader

public HtmlInputStreamReader(InputStream inputStream,
                             ErrorHandler errorHandler,
                             Tokenizer tokenizer,
                             Driver driver,
                             Heuristics heuristics)
                      throws SAXException,
                             IOException
Parameters:
inputStream -
errorHandler -
locator -
Throws:
IOException
SAXException

HtmlInputStreamReader

public HtmlInputStreamReader(InputStream inputStream,
                             ErrorHandler errorHandler,
                             Tokenizer tokenizer,
                             Driver driver,
                             Encoding encoding)
                      throws SAXException,
                             IOException
Throws:
SAXException
IOException
Method Detail

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

readByte

public int readByte()
             throws IOException
Description 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 interface ByteReadable
Returns:
integer from 0 to 0xFF or -1 on EOF
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

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)

switchEncoding

public void switchEncoding(Encoding newEnc)


Copyright © 2012. All Rights Reserved.