|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.io.InputStream tribble.io.ReaderInputStream
public class ReaderInputStream
Pass-through character reader stream.
Reads characters from an underlying Reader
object, returning them as
8-bit character codes. Only the low-order 8 bits of each character is
returned; character codes greater than 0x00FF are truncated to 8 bits.
This is similar to a character stream that reads ISO 8859-1 character
codes as uninterpreted single-byte sequences, i.e., each character code is
composed of a single 8-bit octet read from the input stream.
This class is essentially the inverse of class
InputStreamReader
.
WriterOutputStream
,
PassThruReader
,
InputStreamReader
Field Summary | |
---|---|
protected java.io.Reader |
m_in
Underlying input stream reader. |
protected int |
m_ungetCh
Pushed-back character. |
(package private) static java.lang.String |
REV
Revision information. |
Constructor Summary | |
---|---|
ReaderInputStream(java.io.Reader in)
Constructor. |
Method Summary | |
---|---|
void |
close()
Close this input stream. |
int |
read()
Read a single character. |
int |
read(byte[] buf)
Read a group of characters. |
int |
read(byte[] buf,
int off,
int len)
Read a group of characters. |
java.lang.String |
readLine()
Read a line of text from this input stream. |
Methods inherited from class java.io.InputStream |
---|
available, mark, markSupported, reset, skip |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
static final java.lang.String REV
protected java.io.Reader m_in
protected int m_ungetCh
Constructor Detail |
---|
public ReaderInputStream(java.io.Reader in)
out
- Underlying input stream, which provides a destination for input bytes.Method Detail |
---|
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in class java.io.InputStream
java.io.IOException
- Thrown if an I/O error occurs while closing the underlying input reader.public int read() throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
- Thrown if an I/O error occurs while reading from the underlying input
reader.public int read(byte[] buf) throws java.io.IOException
This method has exactly the same effect as the call: read(buf, 0, buf.length).
read
in class java.io.InputStream
buf
- An array of character bytes to be read.
Each byte represents a single 8-bit character code in the range
[0x0000,0x00FF].
java.io.IOException
- Thrown if an I/O error occurs while reading from the underlying input
reader.public int read(byte[] buf, int off, int len) throws java.io.IOException
read
in class java.io.InputStream
buf
- An array of character bytes to be read.
Each byte represents a single 8-bit character code in the range
[0x0000,0x00FF].off
- Index of the first character in buf to read.len
- Number of characters in buf to read.
java.io.IOException
- Thrown if an I/O error occurs while reading from the underlying input
reader.public java.lang.String readLine() throws java.io.IOException
If the underlying stream is a BufferedReader
,
its readLine() method is called.
Otherwise, characters are read until a terminating newline sequence is
encountered; a line is considered to be terminated by a line feed
(LF, U+000A, '\n'), a carriage return (CR, U+000D, '\r'), or
a carriage return followed immediately by a linefeed (CR LF).
This method is not defined by the InputStream
class, but
is provided as a convenient enhancement.
java.io.IOException
- Thrown if an I/O error occurs while reading from the underlying input
reader.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |