8169556: Wrapping of FileInputStream's native skip and available methods

Wrap further native methods in FileInputStreams

Reviewed-by: chegar, bpb, rriggs
This commit is contained in:
Sunny Chan 2016-01-28 23:13:50 -05:00 committed by Roger Riggs
parent eab488fc01
commit 6cbbf83a1a
6 changed files with 17 additions and 9 deletions

View File

@ -77,13 +77,13 @@ SUNWprivate_1.1 {
Java_java_io_FileDescriptor_initIDs;
Java_java_io_FileDescriptor_sync;
Java_java_io_FileDescriptor_getAppend;
Java_java_io_FileInputStream_available;
Java_java_io_FileInputStream_available0;
Java_java_io_FileInputStream_close0;
Java_java_io_FileInputStream_initIDs;
Java_java_io_FileInputStream_open0;
Java_java_io_FileInputStream_read0;
Java_java_io_FileInputStream_readBytes;
Java_java_io_FileInputStream_skip;
Java_java_io_FileInputStream_skip0;
Java_java_io_FileOutputStream_close0;
Java_java_io_FileOutputStream_initIDs;
Java_java_io_FileOutputStream_open0;

View File

@ -44,7 +44,7 @@ text: .text%Java_java_io_FileInputStream_open0;
text: .text%fileOpen;
text: .text%Java_java_io_FileInputStream_readBytes;
text: .text%readBytes;
text: .text%Java_java_io_FileInputStream_available;
text: .text%Java_java_io_FileInputStream_available0;
text: .text%Java_java_io_FileInputStream_close0;
text: .text%Java_java_lang_System_mapLibraryName;
text: .text%Java_java_io_UnixFileSystem_getBooleanAttributes0;

View File

@ -48,7 +48,7 @@ text: .text%Java_java_io_FileInputStream_open0;
text: .text%fileOpen;
text: .text%Java_java_io_FileInputStream_readBytes;
text: .text%readBytes;
text: .text%Java_java_io_FileInputStream_available;
text: .text%Java_java_io_FileInputStream_available0;
text: .text%Java_java_io_FileInputStream_close0;
text: .text%Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedExceptionAction_2;
text: .text%Java_java_io_UnixFileSystem_list;

View File

@ -76,7 +76,7 @@ text: .text%Java_java_security_AccessController_doPrivileged__Ljava_security_Pri
text: .text%JNU_GetEnv;
text: .text%Java_java_io_UnixFileSystem_checkAccess;
text: .text%Java_sun_reflect_NativeMethodAccessorImpl_invoke0;
text: .text%Java_java_io_FileInputStream_available;
text: .text%Java_java_io_FileInputStream_available0;
text: .text%Java_java_lang_reflect_Array_newArray;
text: .text%Java_java_lang_StackTraceElement_initStackTraceElements;
text: .text%Java_java_lang_System_identityHashCode;

View File

@ -280,7 +280,11 @@ class FileInputStream extends InputStream
* @exception IOException if n is negative, if the stream does not
* support seek, or if an I/O error occurs.
*/
public native long skip(long n) throws IOException;
public long skip(long n) throws IOException {
return skip0(n);
}
private native long skip0(long n) throws IOException;
/**
* Returns an estimate of the number of remaining bytes that can be read (or
@ -299,7 +303,11 @@ class FileInputStream extends InputStream
* @exception IOException if this file input stream has been closed by calling
* {@code close} or an I/O error occurs.
*/
public native int available() throws IOException;
public int available() throws IOException {
return available0();
}
private native int available0() throws IOException;
/**
* Closes this file input stream and releases any system resources

View File

@ -73,7 +73,7 @@ Java_java_io_FileInputStream_readBytes(JNIEnv *env, jobject this,
}
JNIEXPORT jlong JNICALL
Java_java_io_FileInputStream_skip(JNIEnv *env, jobject this, jlong toSkip) {
Java_java_io_FileInputStream_skip0(JNIEnv *env, jobject this, jlong toSkip) {
jlong cur = jlong_zero;
jlong end = jlong_zero;
FD fd = GET_FD(this, fis_fd);
@ -90,7 +90,7 @@ Java_java_io_FileInputStream_skip(JNIEnv *env, jobject this, jlong toSkip) {
}
JNIEXPORT jint JNICALL
Java_java_io_FileInputStream_available(JNIEnv *env, jobject this) {
Java_java_io_FileInputStream_available0(JNIEnv *env, jobject this) {
jlong ret;
FD fd = GET_FD(this, fis_fd);
if (fd == -1) {