|
HTML Parser Home Page | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectjava.io.Reader
org.htmlparser.lexer.Source
A buffered source of characters. A Source is very similar to a the following construct:
new InputStreamReader (new BufferedInputStream (connection.getInputStream ()), charset)It differs from the above, in two ways:
| Field Summary | |
static int |
BUFFER_SIZE
An initial buffer size. |
static int |
EOF
Return value when no more characters are left. |
char[] |
mBuffer
The characters read so far. |
protected String |
mEncoding
The character set in use. |
int |
mLevel
The number of valid bytes in the buffer. |
protected int |
mMark
The bookmark. |
int |
mOffset
The offset of the next byte returned by read(). |
protected InputStreamReader |
mReader
The converter from bytes to characters. |
protected InputStream |
mStream
The stream of bytes. |
| Fields inherited from class java.io.Reader |
lock |
| Constructor Summary | |
Source(InputStream stream)
Create a source of characters using the default character set. |
|
Source(InputStream stream,
String charset)
Create a source of characters. |
|
Source(InputStream stream,
String charset,
int buffer_size)
Create a source of characters. |
|
| Method Summary | |
int |
available()
Get the number of available characters. |
void |
close()
Does nothing. |
void |
destroy()
Close the stream. |
protected void |
fill(int min)
Fetch more characters from the underlying reader. |
String |
getEncoding()
Get the encoding being used to convert characters. |
InputStream |
getStream()
Get the input stream being used. |
void |
mark(int readAheadLimit)
Mark the present position in the stream. |
boolean |
markSupported()
Tell whether this stream supports the mark() operation. |
int |
offset()
Get the position (in characters). |
int |
read()
Read a single character. |
int |
read(char[] cbuf)
Read characters into an array. |
int |
read(char[] cbuf,
int off,
int len)
Read characters into a portion of an array. |
boolean |
ready()
Tell whether this stream is ready to be read. |
void |
reset()
Reset the source. |
long |
skip(long n)
Skip characters. |
void |
unread()
Undo the read of a single character. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static int BUFFER_SIZE
public static final int EOF
protected transient InputStream mStream
protected String mEncoding
protected transient InputStreamReader mReader
public char[] mBuffer
public int mLevel
public int mOffset
protected int mMark
| Constructor Detail |
public Source(InputStream stream)
throws UnsupportedEncodingException
stream - The stream of bytes to use.
public Source(InputStream stream,
String charset)
throws UnsupportedEncodingException
stream - The stream of bytes to use.charset - The character set used in encoding the stream.
public Source(InputStream stream,
String charset,
int buffer_size)
throws UnsupportedEncodingException
stream - The stream of bytes to use.charset - The character set used in encoding the stream.| Method Detail |
public InputStream getStream()
public String getEncoding()
protected void fill(int min)
throws IOException
min - The minimum to read.
IOException - If the underlying reader read() throws one.
public void close()
throws IOException
IOExceptiondestroy()
public int read()
throws IOException
IOException - If an I/O error occurs.
public int read(char[] cbuf,
int off,
int len)
throws IOException
cbuf - Destination bufferoff - Offset at which to start storing characterslen - Maximum number of characters to read
IOException - If an I/O error occurs.
public int read(char[] cbuf)
throws IOException
cbuf - Destination buffer.
IOException - If an I/O error occurs.public void reset()
IllegalStateException - If the source has been closed.public boolean markSupported()
true if and only if this stream supports the mark operation.
public void mark(int readAheadLimit)
throws IOException
readAheadLimit - Not used.
IOException - Never thrown.
public boolean ready()
throws IOException
true if the next read() is guaranteed not to block
for input, false otherwise.
Note that returning false does not guarantee that the next read will block.
IOException - Never thrown.
public long skip(long n)
throws IOException
n - The number of characters to skip.
IllegalArgumentException - If n is negative.
IOException - If an I/O error occurs.
public void unread()
throws IOException
IOException - If no characters have been read.
public void destroy()
throws IOException
IOException - If an I/O error occurspublic int offset()
public int available()
|
© 2004 Somik Raha Mar 14, 2004
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||