当前位置: 技术问答>java相关
一个非常简单的问题,谁能告诉我这个Read()读出的是些什么东西?
来源: 互联网 发布时间:2015-08-29
本文导语: 我想问一下Java.IO下边的*Reader中的Read()方法到底是读出的么东西,越清楚越透彻越好! 谢谢了. | 倒,真的是很简单,不会看api啊:( read public int read() throws IOExceptionRead a single cha...
我想问一下Java.IO下边的*Reader中的Read()方法到底是读出的么东西,越清楚越透彻越好!
谢谢了.
谢谢了.
|
倒,真的是很简单,不会看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派生出来的类?嘿嘿,那有没有重载就要看不同的类了
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派生出来的类?嘿嘿,那有没有重载就要看不同的类了
|
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
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
|
返回输入流中当前可用字符的整数表示。如果到达文件结尾,返回-1。
也就是这样了,不知道怎么再详细了。:)
也就是这样了,不知道怎么再详细了。:)