read
public int read(byte[] b)
         throws IOException
Reads up to b.length bytes of data from this input stream into an array of bytes. This method blocks until some input is available. Overrides:
read in class InputStream
Parameters:
b - the buffer into which the data is read. 
Returns:
the total number of bytes read into the buffer, or -1 if there is no more data because the end of the file has been reached. 
Throws: 
IOException - if an I/O error occurs.
See Also:
InputStream.read(byte[], int, int)--------------------------------------------------------------------------------主要就是 判断时候还有文件没有读入!

解决方案 »

  1.   

    对不起,我问的是InputStream.read(byte[], int, int)
    这个方法的用法
      

  2.   

    public int read( byte b[], int off, int len ) throws IOException 
    Parameters

    the buffer into which the data is read. 
    off 
    the start offset of the data. 
    len 
    the maximum number of bytes read. 
    Returns
    the total number of bytes read into the buffer, or -1 if there is no more data because the end of the file has been reached. 
    Description
    Reads up to len bytes of data from this input stream into an array of bytes. This method blocks until some input is available. Exceptions
    IOException if an I/O error occurs. 
    看看有没有用。
      

  3.   

    InputStream.read(byte[] b , int off, int len)
    从off位置开始读len长字节入b