InputStreamReader
port of InputStreamReader
An InputStreamReader is a bridge from byte streams to character streams: It reads bytes and decodes them into characters using a specified [ ]. The charset that it uses may be specified by name or may be given explicitly, or the default charset may be used.
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.
For top efficiency, consider wrapping an InputStreamReader within a BufferedReader. For example:
{@snippet lang=java :
BufferedReader in = new BufferedReader(new InputStreamReader(anInputStream));Content copied to clipboard}
Author
Mark Reinhold
Since
1.1
See also
Constructors
Creates an InputStreamReader that uses the default charset.
Creates an InputStreamReader that uses the given charset.
Creates an InputStreamReader that uses the given charset decoder.
Functions
Reads a single character.
Reads characters into a CharBuffer. This default implementation reads into an array and then puts the characters into the buffer.
{@inheritDoc}
Resets the stream. If the stream has been marked, then attempt to reposition it at the mark. If the stream has not been marked, then attempt to reset it in some way appropriate to the particular stream, for example by repositioning it to its starting point. Not all character-input streams support the reset() operation, and some support reset() without supporting mark().
Reads all characters from this Reader and writes them to out. Returns the number of characters transferred.