# Class HtmlInputStreamReader

java.lang.Object
java.io.Reader
nu.validator.htmlparser.io.HtmlInputStreamReader

All Implemented Interfaces:
  `Closeable, AutoCloseable, Readable, ByteReadable, Locator2, Locator`

public final class HtmlInputStreamReader extends Reader implements ByteReadable, Locator, 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

### Fields inherited from class Reader

`lock`

## Constructor Summary

Constructors
Constructor
Description
`HtmlInputStreamReader(InputStream inputStream, ErrorHandler errorHandler, Tokenizer tokenizer, Driver driver, Heuristics heuristics)`
`HtmlInputStreamReader(InputStream inputStream, ErrorHandler errorHandler, Tokenizer tokenizer, Driver driver, Heuristics heuristics, int sniffingLimit)`
`HtmlInputStreamReader(InputStream inputStream, ErrorHandler errorHandler, Tokenizer tokenizer, Driver driver, Encoding encoding)`

## Method Summary

Modifier and Type
Method
Description
`void`
`close()`
`Charset`
`getCharset()`
`int`
`getColumnNumber()`
`String`
`getEncoding()`
`int`
`getLineNumber()`
`String`
`getPublicId()`
`String`
`getSystemId()`
`String`
`getXMLVersion()`
`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 Reader

`mark, markSupported, nullReader, of, readAllAsString, readAllLines, ready, reset, skip, transferTo`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### HtmlInputStreamReader

public HtmlInputStreamReader(InputStream inputStream, ErrorHandler errorHandler, Tokenizer tokenizer, Driver driver, Heuristics heuristics, int sniffingLimit) throws SAXException, IOException

Parameters:
  `inputStream` -
  `errorHandler` -
  `tokenizer` -
  `driver` -
  `heuristics` -
  `sniffingLimit` -
Throws:
  `IOException`
  `SAXException`

### HtmlInputStreamReader

public HtmlInputStreamReader(InputStream inputStream, ErrorHandler errorHandler, Tokenizer tokenizer, Driver driver, Heuristics heuristics) throws SAXException, IOException

Throws:
  `SAXException`
  `IOException`

### HtmlInputStreamReader

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

Throws:
  `SAXException`
  `IOException`

## Method Details

### close

public void close() throws IOException

Specified by:
  `close` in interface `AutoCloseable`
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`

### getXMLVersion

public String getXMLVersion()

Specified by:
  `getXMLVersion` in interface `Locator2`

### getEncoding

public String getEncoding()

Specified by:
  `getEncoding` in interface `Locator2`

### 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)