Reader is the abstract class for reading character streams.
The following table lists the reader and writer classes which deal with the character based stream.
- Buffered input character stream
- Buffered output character stream
- Input stream that reads from a character array
- Output stream that writes to a character array
- Input stream that reads from a file
- Output stream that writes to a file
- Filtered reader
- Filtered writer
- Input stream that translates bytes to characters
- Input stream that counts lines
- Output stream that translates characters to bytes
- Input pipe
- Output pipe
- Output stream that contains print( ) and println( )
- Input stream that allows characters to be returned to the input stream
- Abstract class that describes character stream input
- Input stream that reads from a string
- Output stream that writes to a string
- Abstract class that describes character stream output
The Predefined Streams
System.out refers to the standard output stream. By default, this is the console. System.in refers to standard input, which is the keyboard by default. System.err refers to the standard error stream, which also is the console by default. System.in is an object of type InputStream; System.out and System.err are objects of type PrintStream.
The following methods are defined by Reader.
abstract void close()
- Closes the stream and releases any system resources associated with it.
void mark(int readAheadLimit)
- Marks the present position in the stream.
- Tells whether this stream supports the mark() operation.
- Reads a single character.
int read(char cbuf)
- Reads characters into an array.
abstract int read(char cbuf, int off, int len)
- Reads characters into a portion of an array.
int read(CharBuffer target)
- Attempts to read characters into the specified character buffer.
- Tells whether this stream is ready to be read.
- Resets the stream.
long skip(long n)
- Skips characters.
Revised from Open JDK source code