什么*reader?
看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
就知道这个函数返回什么了
read
public int read()
throws IOException
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
public int read(char[] cbuf)
throws IOException
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 characters read, or -1 if the end of the stream has been reached
Throws:
IOException - If an I/O error occurs
read
public abstract int read(char[] cbuf,
int off,
int len)
throws IOException
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
倒,真的是很简单,不会看api啊:(
read
public int read()
throws IOExceptionRead 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
为什么是*Reader?指的事reader派生出来的类?嘿嘿,那有没有重载就要看不同的类了