src/share/classes/java/io/FileInputStream.java

Print this page
rev 9260 : JDK-8033911: Simplify instrumentation of FileInputStream and RandomAccessFile
Reviewed-by:


 169          * FileDescriptor is being shared by streams.
 170          * Register this stream with FileDescriptor tracker.
 171          */
 172         fd.attach(this);
 173     }
 174 
 175     /**
 176      * Opens the specified file for reading.
 177      * @param name the name of the file
 178      */
 179     private native void open(String name) throws FileNotFoundException;
 180 
 181     /**
 182      * Reads a byte of data from this input stream. This method blocks
 183      * if no input is yet available.
 184      *
 185      * @return     the next byte of data, or <code>-1</code> if the end of the
 186      *             file is reached.
 187      * @exception  IOException  if an I/O error occurs.
 188      */
 189     public native int read() throws IOException;




 190 
 191     /**
 192      * Reads a subarray as a sequence of bytes.
 193      * @param b the data to be written
 194      * @param off the start offset in the data
 195      * @param len the number of bytes that are written
 196      * @exception IOException If an I/O error has occurred.
 197      */
 198     private native int readBytes(byte b[], int off, int len) throws IOException;
 199 
 200     /**
 201      * Reads up to <code>b.length</code> bytes of data from this input
 202      * stream into an array of bytes. This method blocks until some input
 203      * is available.
 204      *
 205      * @param      b   the buffer into which the data is read.
 206      * @return     the total number of bytes read into the buffer, or
 207      *             <code>-1</code> if there is no more data because the end of
 208      *             the file has been reached.
 209      * @exception  IOException  if an I/O error occurs.




 169          * FileDescriptor is being shared by streams.
 170          * Register this stream with FileDescriptor tracker.
 171          */
 172         fd.attach(this);
 173     }
 174 
 175     /**
 176      * Opens the specified file for reading.
 177      * @param name the name of the file
 178      */
 179     private native void open(String name) throws FileNotFoundException;
 180 
 181     /**
 182      * Reads a byte of data from this input stream. This method blocks
 183      * if no input is yet available.
 184      *
 185      * @return     the next byte of data, or <code>-1</code> if the end of the
 186      *             file is reached.
 187      * @exception  IOException  if an I/O error occurs.
 188      */
 189     public int read() throws IOException {
 190         return read0();
 191     }
 192 
 193     private native int read0() throws IOException;
 194 
 195     /**
 196      * Reads a subarray as a sequence of bytes.
 197      * @param b the data to be written
 198      * @param off the start offset in the data
 199      * @param len the number of bytes that are written
 200      * @exception IOException If an I/O error has occurred.
 201      */
 202     private native int readBytes(byte b[], int off, int len) throws IOException;
 203 
 204     /**
 205      * Reads up to <code>b.length</code> bytes of data from this input
 206      * stream into an array of bytes. This method blocks until some input
 207      * is available.
 208      *
 209      * @param      b   the buffer into which the data is read.
 210      * @return     the total number of bytes read into the buffer, or
 211      *             <code>-1</code> if there is no more data because the end of
 212      *             the file has been reached.
 213      * @exception  IOException  if an I/O error occurs.