java::io::Reader Class Reference

Inheritance diagram for java::io::Reader:

Inheritance graph
java::io::BufferedReaderjava::io::CharArrayReaderjava::io::FilterReaderjava::io::InputStreamReaderjava::lang::Interfacejava::lang::Objectjava::io::FileReader
[legend]
Collaboration diagram for java::io::Reader:

Collaboration graph
java::lang::Interfacejava::lang::Object
[legend]

List of all members.


Detailed Description

Interface 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.

Version:
1.23, 01/12/03
Author:
Mark Reinhold
Since:
JDK1.1

Public Member Functions

virtual jint read ()=0
 Read a single character.
virtual jint read (Array< jchar > &b, jint ofs=0, jint len=-1)=0
 Read characters into a portion of an array.
virtual jlong skip (jlong n)=0
 Skip characters.
virtual jboolean ready ()
 Tell whether this stream is ready to be read.
virtual void close ()
 Close the stream.
virtual void mark (jint readlimit=0)
 Mark the present position in the stream.
virtual void reset ()
 Reset the stream.
virtual jboolean markSupported ()
 Tell whether this stream supports the mark() operation.

Member Function Documentation

virtual jint java::io::Reader::read (  )  [pure virtual]

Read a single character.

This method will block until a character is available, an I/O error occurs, or the end of the stream is reached.

Subclasses that intend to support efficient single-character input should override this method.

Returns:
The character read, as an integer in the range 0 to 65535 (0x00-0xffff), or -1 if the end of the stream has been reached
Exceptions:
IOException If an I/O error occurs

Implemented in java::io::BufferedReader, java::io::CharArrayReader, java::io::FilterReader, and java::io::InputStreamReader.

virtual jint java::io::Reader::read ( Array< jchar > &  b,
jint  ofs = 0,
jint  len = -1 
) [pure virtual]

Read characters into a portion of an array.

This method will block until some input is available, an I/O error occurs, or the end of the stream is reached.

Parameters:
cbuf Destination buffer
off Offset at which to start storing characters
len Maximum number of characters to read
Returns:
The number of characters read, or -1 if the end of the stream has been reached
Exceptions:
IOException If an I/O error occurs

Implemented in java::io::BufferedReader, java::io::CharArrayReader, java::io::FilterReader, and java::io::InputStreamReader.

virtual jlong java::io::Reader::skip ( jlong  n  )  [pure virtual]

Skip characters.

This method will block until some characters are available, an I/O error occurs, or the end of the stream is reached.

Parameters:
n The number of characters to skip
Returns:
The number of characters actually skipped
Exceptions:
IllegalArgumentException If n is negative.
IOException If an I/O error occurs

Implemented in java::io::BufferedReader, java::io::CharArrayReader, java::io::FilterReader, and java::io::InputStreamReader.

virtual jboolean java::io::Reader::ready (  )  [virtual]

Tell whether this stream is ready to be read.

Returns:
True if the next read() is guaranteed not to block for input, false otherwise. Note that returning false does not guarantee that the next read will block.
Exceptions:
IOException If an I/O error occurs

Reimplemented in java::io::BufferedReader, java::io::CharArrayReader, java::io::FilterReader, and java::io::InputStreamReader.

virtual void java::io::Reader::close (  )  [virtual]

Close the stream.

Once a stream has been closed, further read(), ready(), mark(), or reset() invocations will throw an IOException. Closing a previously-closed stream, however, has no effect.

Exceptions:
IOException If an I/O error occurs

Reimplemented in java::io::BufferedReader, java::io::CharArrayReader, java::io::FilterReader, and java::io::InputStreamReader.

virtual void java::io::Reader::mark ( jint  readlimit = 0  )  [virtual]

Mark the present position in the stream.

Subsequent calls to reset() will attempt to reposition the stream to this point. Not all character-input streams support the mark() operation.

Parameters:
readAheadLimit Limit on the number of characters that may be read while still preserving the mark. After reading this many characters, attempting to reset the stream may fail.
Exceptions:
IOException If the stream does not support mark(), or if some other I/O error occurs

Reimplemented in java::io::BufferedReader, java::io::CharArrayReader, and java::io::FilterReader.

virtual void java::io::Reader::reset (  )  [virtual]

Reset the stream.

If the stream has been marked, then attempt to reposition it at the mark. If the stream has not been marked, then attempt to reset it in some way appropriate to the particular stream, for example by repositioning it to its starting point. Not all character-input streams support the reset() operation, and some support reset() without supporting mark().

Exceptions:
IOException If the stream has not been marked, or if the mark has been invalidated, or if the stream does not support reset(), or if some other I/O error occurs

Reimplemented in java::io::BufferedReader, java::io::CharArrayReader, and java::io::FilterReader.

virtual jboolean java::io::Reader::markSupported (  )  [virtual]

Tell whether this stream supports the mark() operation.

The default implementation always returns false. Subclasses should override this method.

Returns:
true if and only if this stream supports the mark operation.

Reimplemented in java::io::BufferedReader, java::io::CharArrayReader, and java::io::FilterReader.


The documentation for this class was generated from the following file:
Generated on Fri May 16 11:56:33 2008 for CrossPlatformJavaLikeC++API by  doxygen 1.5.3