Reader
class are:
ready()
andread()
skip()
andclose()
mark()
andreset()
We will be examining each of these methods in the next several lessons.
All of these methods are present in the various subclasses of java.io.Reader.
Lesson 4 | Java Reader class |
Objective | Investigate the fundamental methods of the Reader class. |
java.io.Reader
class provides text-based input to Java programs. A stream is the source of the bytes containing the text.
However, as the bytes are read they are converted into Java chars
before being passed on to the other parts of the program.
One or more bytes may be read for each character produced.
java.io.Reader
class are deliberately similar to the methods of the java.io.InputStream
class.
However, rather than working with bytes, they work with chars
.
Reader
class are:
ready()
and read()
skip()
and close()
mark()
and reset()
public abstract int read(char[] buffer, int offset, int length) throws IOException
public int read(char[] buffer) throws IOException
public int read() throws IOException