提交 558d8d76 编写于 作者: S sla

8033911: Simplify instrumentation of FileInputStream and RandomAccessFile

Reviewed-by: alanb, dsamersoff, jbachorik
上级 82ea0dd6
...@@ -79,7 +79,7 @@ SUNWprivate_1.1 { ...@@ -79,7 +79,7 @@ SUNWprivate_1.1 {
Java_java_io_FileInputStream_close0; Java_java_io_FileInputStream_close0;
Java_java_io_FileInputStream_initIDs; Java_java_io_FileInputStream_initIDs;
Java_java_io_FileInputStream_open; Java_java_io_FileInputStream_open;
Java_java_io_FileInputStream_read; Java_java_io_FileInputStream_read0;
Java_java_io_FileInputStream_readBytes; Java_java_io_FileInputStream_readBytes;
Java_java_io_FileInputStream_skip; Java_java_io_FileInputStream_skip;
Java_java_io_FileOutputStream_close0; Java_java_io_FileOutputStream_close0;
...@@ -98,11 +98,11 @@ SUNWprivate_1.1 { ...@@ -98,11 +98,11 @@ SUNWprivate_1.1 {
Java_java_io_RandomAccessFile_initIDs; Java_java_io_RandomAccessFile_initIDs;
Java_java_io_RandomAccessFile_length; Java_java_io_RandomAccessFile_length;
Java_java_io_RandomAccessFile_open; Java_java_io_RandomAccessFile_open;
Java_java_io_RandomAccessFile_read; Java_java_io_RandomAccessFile_read0;
Java_java_io_RandomAccessFile_readBytes; Java_java_io_RandomAccessFile_readBytes;
Java_java_io_RandomAccessFile_seek0; Java_java_io_RandomAccessFile_seek0;
Java_java_io_RandomAccessFile_setLength; Java_java_io_RandomAccessFile_setLength;
Java_java_io_RandomAccessFile_write; Java_java_io_RandomAccessFile_write0;
Java_java_io_RandomAccessFile_writeBytes; Java_java_io_RandomAccessFile_writeBytes;
Java_java_io_UnixFileSystem_canonicalize0; Java_java_io_UnixFileSystem_canonicalize0;
Java_java_io_UnixFileSystem_checkAccess; Java_java_io_UnixFileSystem_checkAccess;
......
...@@ -186,7 +186,11 @@ class FileInputStream extends InputStream ...@@ -186,7 +186,11 @@ class FileInputStream extends InputStream
* file is reached. * file is reached.
* @exception IOException if an I/O error occurs. * @exception IOException if an I/O error occurs.
*/ */
public native int read() throws IOException; public int read() throws IOException {
return read0();
}
private native int read0() throws IOException;
/** /**
* Reads a subarray as a sequence of bytes. * Reads a subarray as a sequence of bytes.
......
...@@ -309,7 +309,11 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable { ...@@ -309,7 +309,11 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
* @exception IOException if an I/O error occurs. Not thrown if * @exception IOException if an I/O error occurs. Not thrown if
* end-of-file has been reached. * 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. * Reads a sub array as a sequence of bytes.
...@@ -457,7 +461,11 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable { ...@@ -457,7 +461,11 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
* @param b the {@code byte} to be written. * @param b the {@code byte} to be written.
* @exception IOException if an I/O error occurs. * @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. * Writes a sub array as a sequence of bytes.
......
...@@ -62,7 +62,7 @@ Java_java_io_FileInputStream_open(JNIEnv *env, jobject this, jstring path) { ...@@ -62,7 +62,7 @@ Java_java_io_FileInputStream_open(JNIEnv *env, jobject this, jstring path) {
} }
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_java_io_FileInputStream_read(JNIEnv *env, jobject this) { Java_java_io_FileInputStream_read0(JNIEnv *env, jobject this) {
return readSingle(env, this, fis_fd); return readSingle(env, this, fis_fd);
} }
......
...@@ -64,7 +64,7 @@ Java_java_io_RandomAccessFile_open(JNIEnv *env, ...@@ -64,7 +64,7 @@ Java_java_io_RandomAccessFile_open(JNIEnv *env,
} }
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_java_io_RandomAccessFile_read(JNIEnv *env, jobject this) { Java_java_io_RandomAccessFile_read0(JNIEnv *env, jobject this) {
return readSingle(env, this, raf_fd); return readSingle(env, this, raf_fd);
} }
...@@ -75,7 +75,7 @@ Java_java_io_RandomAccessFile_readBytes(JNIEnv *env, ...@@ -75,7 +75,7 @@ Java_java_io_RandomAccessFile_readBytes(JNIEnv *env,
} }
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_java_io_RandomAccessFile_write(JNIEnv *env, jobject this, jint byte) { Java_java_io_RandomAccessFile_write0(JNIEnv *env, jobject this, jint byte) {
writeSingle(env, this, byte, JNI_FALSE, raf_fd); writeSingle(env, this, byte, JNI_FALSE, raf_fd);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册