- java.lang.Object
-
- java.io.Reader
-
- All Implemented Interfaces:
Closeable,AutoCloseable,Readable
- Direct Known Subclasses:
BufferedReader,CharArrayReader,FilterReader,InputStreamReader,PipedReader,StringReader,URLReader
public abstract class Reader extends Object implements Readable, Closeable
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.- Since:
- 1.1
- See Also:
BufferedReader,LineNumberReader,CharArrayReader,InputStreamReader,FileReader,FilterReader,PushbackReader,PipedReader,StringReader,Writer
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedReader()Creates a new character-stream reader whose critical sections will synchronize on the reader itself.protectedReader(Object lock)Creates a new character-stream reader whose critical sections will synchronize on the given object.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voidclose()Closes the stream and releases any system resources associated with it.voidmark(int readAheadLimit)Marks the present position in the stream.booleanmarkSupported()Tells whether this stream supports the mark() operation.static ReadernullReader()Returns a newReaderthat reads no characters.intread()Reads a single character.intread(char[] cbuf)Reads characters into an array.abstract intread(char[] cbuf, int off, int len)Reads characters into a portion of an array.intread(CharBuffer target)Attempts to read characters into the specified character buffer.booleanready()Tells whether this stream is ready to be read.voidreset()Resets the stream.longskip(long n)Skips characters.longtransferTo(Writer out)Reads all characters from this reader and writes the characters to the given writer in the order that they are read.
-