src/share/classes/java/io/RandomAccessFile.java

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

@@ -307,11 +307,15 @@
      * @return     the next byte of data, or {@code -1} if the end of the
      *             file has been reached.
      * @exception  IOException  if an I/O error occurs. Not thrown if
      *                          end-of-file has been reached.
      */
-    public native int read() throws IOException;
+    public int read() throws IOException {
+        return read0();
+    }
+
+    private native int read0() throws IOException;
 
     /**
      * Reads a sub array as a sequence of bytes.
      * @param b the buffer into which the data is read.
      * @param off the start offset of the data.

@@ -455,11 +459,15 @@
      * the current file pointer.
      *
      * @param      b   the {@code byte} to be written.
      * @exception  IOException  if an I/O error occurs.
      */
-    public native void write(int b) throws IOException;
+    public void write(int b) throws IOException {
+        write0(b);
+    }
+
+    private native void write0(int b) throws IOException;
 
     /**
      * Writes a sub array as a sequence of bytes.
      * @param b the data to be written