Sunday 10 March 2013

Fields lock


Fields
lock

Declaration:
protected java.lang.Object lock
Description:
The object used to synchronize operations on this stream. For efficiency, a character-stream object may use
an object other than itself to protect critical sections. A subclass should therefore use the object in this field
rather than this or a synchronized method.
Constructors
Reader()
Declaration:
protected Reader()
Description:
Create a new character-stream reader whose critical sections will synchronize on the reader itself.
Reader(Object)
Declaration:
protected Reader(java.lang.Object lock)
Description:
Create a new character-stream reader whose critical sections will synchronize on the given object.
Parameters:
lock - The Object to synchronize on.

Methods
read()
Declaration:
public int read()
throws IOException
Description:
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
Throws:
IOException - If an I/O error occurs
read(char[])
Declaration:
public int read(char[] cbuf)
throws IOException
Description:
Read characters into 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
Returns: The number of bytes read, or -1 if the end of the stream has been reached
Throws:
IOException - If an I/O error occurs
read(char[], int, int)
Declaration:
public abstract int read(char[] cbuf, int off, int len)
throws IOException
Description:
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
Throws:
IOException - If an I/O error occurs

skip(long)
Declaration:
public long skip(long n)
throws IOException
Description:
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

ready()

Throws:
java.lang.IllegalArgumentException - If n is negative.
IOException - If an I/O error occurs




No comments:

Post a Comment