[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
FYI: native JNI FileChannelImpl.size() implemented
From: |
Mark Wielaard |
Subject: |
FYI: native JNI FileChannelImpl.size() implemented |
Date: |
Sun, 11 Apr 2004 15:14:29 +0200 |
Hi,
The following implements the native JNI FileChannelImpl.size() method.
It is a simple copy/paste of the old FileDescriptor.getNativeLenght()
implementation.
2004-04-11 Mark Wielaard <address@hidden>
* native/jni/java-nio/gnu_java_nio_channels_FileChannelImpl.c
(Java_gnu_java_nio_channels_FileChannelImpl_size): Implemented.
This solves a large number of mauve failures that depended on being able
to get the size of a file.
Cheers,
Mark
Index: native/jni/java-nio/gnu_java_nio_channels_FileChannelImpl.c
===================================================================
RCS file:
/cvsroot/classpath/classpath/native/jni/java-nio/gnu_java_nio_channels_FileChannelImpl.c,v
retrieving revision 1.3
diff -u -r1.3 gnu_java_nio_channels_FileChannelImpl.c
--- native/jni/java-nio/gnu_java_nio_channels_FileChannelImpl.c 9 Apr 2004
17:35:56 -0000 1.3
+++ native/jni/java-nio/gnu_java_nio_channels_FileChannelImpl.c 11 Apr 2004
13:09:40 -0000
@@ -266,8 +266,21 @@
JNIEXPORT jlong JNICALL
Java_gnu_java_nio_channels_FileChannelImpl_size (JNIEnv *env, jobject obj)
{
- JCL_ThrowException (env, IO_EXCEPTION, "java.nio.FileChannelImpl.size(): not
implemented");
- return TARGET_NATIVE_MATH_INT_INT64_CONST_0;
+ int native_fd;
+ jlong file_size;
+ int result;
+
+ native_fd = get_native_fd(env, obj);
+
+ TARGET_NATIVE_FILE_SIZE(native_fd, file_size, result);
+ if (result != TARGET_NATIVE_OK)
+ {
+ JCL_ThrowException(env, IO_EXCEPTION,
+ TARGET_NATIVE_LAST_ERROR_STRING());
+ return TARGET_NATIVE_MATH_INT_INT64_CONST_MINUS_1;
+ }
+
+ return file_size;
}
/*************************************************************************/
/*
signature.asc
Description: This is a digitally signed message part
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- FYI: native JNI FileChannelImpl.size() implemented,
Mark Wielaard <=