没有看懂这一段代码,请问一下为什么运行出来的是4:abcd。是怎么看出来的呀
int m=fileInputStream.read(tom);
这里的read返回值 Int 是读入缓冲区的总字节数,并不是byte tom 缓冲区的大小 100.
/**
* Reads up to <code>b.length</code> bytes of data from this input
* stream into an array of bytes. This method blocks until some input
* is available.
*
* @param b the buffer into which the data is read.
* @return the total number of bytes read into the buffer, or
* <code>-1</code> if there is no more data because the end of
* the file has been reached.
* @exception IOException if an I/O error occurs.
*/
public int read(byte b[]) throws IOException {
return readBytes(b, 0, b.length);
}