Reader class methods in Java

java.io.Reader

Abstract class for reading character streams. The only methods that a subclass must implement are read(char[], int, int), and close(). Most subclasses, however, will override some of the methods defined here in order to provide higher efficiency, additional functionality, or both.

Implemented Interfaces:

Closeable,

AutoCloseable

Subclasses:

BufferedReader

CharArrayReader

FilterReader

InputStreamReader

PipedReader

StringReader

Some methods of Reader class

close()This method closes the stream and releases any system resources associated with it.

mark(int)This method marks the present position in the stream.

markSupported()This method tells whether this stream supports the mark() operation. 

Reader.nullReader()This method returns a new Reader that reads no characters.

read()This method reads a single character.

read(char[])This method reads characters into an array.

read(CharBuffer)This method attempts to read characters into the specified character buffer.

read(char[], int, int)This method reads characters into a portion of an array.

ready()This method tells whether this stream is ready to be read.

reset()This method resets the stream.

skip(long)This method skips characters.

transferTo(Writer)This method reads all characters from this reader and writes the characters to the given writer in the order that they are read.

No comments:

Post a Comment