Topics Index

Input/Output: Exploring > Character Streams >
Siva Nookala - 20 Feb 2017
Reader is an abstract class in Java. It is useful in reading character streams. The methods that a subclass must implement are read(char[], int, int) and close(). However some of the sub classes override some of the methods defined by Reader to provide higher efficiency, additional functionality, or both.

The sub classes of Reader are BufferedReader In Java, Java CharArrayReader, Java FileReader, FilterReader, Java PushbackReader, PipedReader, StringReader
Important Methods :
Methods Description
boolean ready() Tells whether this stream is ready to be read.
int read() Reads a single character.
int read(char[] cbuf) Reads characters into an array.
int read(CharBuffer target) Attempts to read characters into the specified character buffer.
boolean markSupported() Tells whether this stream supports the mark() operation.
void mark(int readAheadLimit) Marks the present position in the stream.
void reset() Resets the stream.
abstract void close() Closes the stream and releases any system resources associated with it.
Rest of Methods :
Method Description
abstract int read(char[] cbuf, int off, int len) Reads characters into a portion of an array.
long skip(long n) Skips characters.

Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App