| |
|
| java.lang.Object java.io.Reader java.io.InputStreamReader
All known Subclasses: java.io.FileReader,
InputStreamReader | public class InputStreamReader extends Reader (Code) | | InputStreamReader is class for turning a byte Stream into a character Stream.
Data read from the source input stream is converted into characters by either
a default or provided character converter. By default, the encoding is
assumed to ISO8859_1. The InputStreamReader contains a buffer of bytes read
from the source input stream and converts these into characters as needed.
The buffer size is 8K.
See Also: OutputStreamWriter |
Inner Class :static class HistoricalNamesUtil | |
Method Summary | |
public void | close() Close this InputStreamReader. | public String | getEncoding() Answer the String which identifies the encoding used to convert bytes to
characters. | public int | read() Reads a single character from this InputStreamReader and returns the
result as an int. | public int | read(char[] buf, int offset, int length) Reads at most count characters from this Reader and stores
them at offset in the character array buf .
Returns the number of characters actually read or -1 if the end of reader
was encountered. | public boolean | ready() Answers a boolean indicating whether or not this
InputStreamReader is ready to be read without blocking. |
InputStreamReader | public InputStreamReader(InputStream in)(Code) | | Constructs a new InputStreamReader on the InputStream in .
Now character reading can be filtered through this InputStreamReader.
This constructor assumes the default conversion of ISO8859_1
(ISO-Latin-1).
Parameters: in - the InputStream to convert to characters. |
InputStreamReader | public InputStreamReader(InputStream in, String enc) throws UnsupportedEncodingException(Code) | | Constructs a new InputStreamReader on the InputStream in .
Now character reading can be filtered through this InputStreamReader.
This constructor takes a String parameter enc which is the
name of an encoding. If the encoding cannot be found, an
UnsupportedEncodingException error is thrown.
Parameters: in - the InputStream to convert to characters. Parameters: enc - a String describing the character converter to use. throws: UnsupportedEncodingException - if the encoding cannot be found. |
InputStreamReader | public InputStreamReader(InputStream in, CharsetDecoder dec)(Code) | | Constructs a new InputStreamReader on the InputStream in
and CharsetDecoder dec . Now character reading can be
filtered through this InputStreamReader.
Parameters: in - the InputStream to convert to characters Parameters: dec - a CharsetDecoder used by the character conversion |
InputStreamReader | public InputStreamReader(InputStream in, Charset charset)(Code) | | Constructs a new InputStreamReader on the InputStream in
and Charset charset . Now character reading can be
filtered through this InputStreamReader.
Parameters: in - the InputStream to convert to characters Parameters: charset - the Charset that specify the character converter |
close | public void close() throws IOException(Code) | | Close this InputStreamReader. This implementation closes the source
InputStream and releases all local storage.
throws: IOException - If an error occurs attempting to close thisInputStreamReader. |
getEncoding | public String getEncoding()(Code) | | Answer the String which identifies the encoding used to convert bytes to
characters. The value null is returned if this Reader has
been closed.
the String describing the converter or null if this Reader isclosed. |
read | public int read() throws IOException(Code) | | Reads a single character from this InputStreamReader and returns the
result as an int. The 2 higher-order characters are set to 0. If the end
of reader was encountered then return -1. The byte value is either
obtained from converting bytes in this readers buffer or by first filling
the buffer from the source InputStream and then reading from the buffer.
the character read or -1 if end of reader. throws: IOException - If the InputStreamReader is already closed or some other IOerror occurs. |
read | public int read(char[] buf, int offset, int length) throws IOException(Code) | | Reads at most count characters from this Reader and stores
them at offset in the character array buf .
Returns the number of characters actually read or -1 if the end of reader
was encountered. The bytes are either obtained from converting bytes in
this readers buffer or by first filling the buffer from the source
InputStream and then reading from the buffer.
Parameters: buf - character array to store the read characters Parameters: offset - offset in buf to store the read characters Parameters: length - maximum number of characters to read the number of characters read or -1 if end of reader. throws: IOException - If the InputStreamReader is already closed or some other IOerror occurs. |
ready | public boolean ready() throws IOException(Code) | | Answers a boolean indicating whether or not this
InputStreamReader is ready to be read without blocking. If the result is
true , the next read() will not block. If
the result is false this Reader may or may not block when
read() is sent. This implementation answers
true if there are bytes available in the buffer or the
source InputStream has bytes available.
true if the receiver will not block whenread() is called, false if unknownor blocking will occur. throws: IOException - If the InputStreamReader is already closed or some other IOerror occurs. |
|
|
|