FileInputStream.read

FileInputStream.read

Class Overview | Class Members | This Package | All Packages

Syntax 1
public native int read() throws IOException
Returns
the next byte of data, or -1 if the end of the file is reached.
Description
Reads a byte of data from this input stream. This method blocks if no input is yet available.

Exceptions
IOException if an I/O error occurs.
Overrides
read in class InputStream



Syntax 2
public int read( byte b[] ) throws IOException
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.
Description
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.

Exceptions
IOException if an I/O error occurs.
Overrides
read in class InputStream



Syntax 3
public int read( byte b[], int off, int len ) throws IOException
Parameters
b
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.
Overrides
read in class InputStream