public class InputStreamReader
ImplementsAutoCloseable
An InputStreamReader is a bridge from byte streams to character streams: It reads bytes and translates them into characters. The encoding that it uses may be specified by name, or the platform’s default encoding may be accepted.
Each invocation of one of an InputStreamReader’s read() methods may cause one or more bytes to be read from the underlying byte input stream. To enable the efficient conversion of bytes to characters, more bytes may be read ahead from the underlying stream than are necessary to satisfy the current read operation.
Since: CLDC 1.0 See Also:Reader, UnsupportedEncodingException
Constructors
public InputStreamReader(InputStream is) | Create an InputStreamReader that uses the default character encoding. |
public InputStreamReader(InputStream is, String enc)
throws UnsupportedEncodingException | Create an InputStreamReader that uses the named character encoding. |
Methods
public void close()
throws IOException | Close the stream. |
public void mark(int readAheadLimit)
throws IOException | Mark the present position in the stream. |
public boolean markSupported() | Tell whether this stream supports the mark() operation. |
public int read()
throws IOException | Read a single character. |
public int read(char[] cbuf, int off, int len)
throws IOException | Read characters into a portion of an array. |
public boolean ready()
throws IOException | Tell whether this stream is ready to be read. |
public void reset()
throws IOException | Reset the stream. |
public long skip(long n)
throws IOException | Skip characters. |
Inherited fields
Inherited methods
Constructor details
InputStreamReader
public InputStreamReader(InputStream is)Create an InputStreamReader that uses the default character encoding.
is - An InputStream
InputStreamReader
public InputStreamReader(InputStream is, String enc)
throws UnsupportedEncodingExceptionCreate an InputStreamReader that uses the named character encoding. is - An InputStreamenc - The name of a supported character encoding
- If the named encoding is not supported
Method details
close
public void close()
throws IOExceptionClose the stream. Closing a previously closed stream has no effect.
Throws
mark
public void mark(int readAheadLimit)
throws IOExceptionMark the present position in the stream.
Throws
markSupported
public boolean markSupported()Tell whether this stream supports the mark() operation.
read
public int read()
throws IOExceptionRead a single character.
Throws
read
public int read(char[] cbuf, int off, int len)
throws IOExceptionRead characters into a portion of an array.
Throws
ready
public boolean ready()
throws IOExceptionTell whether this stream is ready to be read.
Throws
reset
public void reset()
throws IOExceptionReset the stream.
Throws
skip
public long skip(long n)
throws IOExceptionSkip characters.