< prev index next >

src/java.base/unix/native/libjava/FileInputStream_md.c

Print this page




  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 #include <sys/types.h>
  27 #include <sys/stat.h>
  28 #include <fcntl.h>
  29 #include <unistd.h>
  30 
  31 #include "jni.h"
  32 #include "jni_util.h"
  33 #include "jvm.h"
  34 #include "io_util.h"
  35 #include "io_util_md.h"
  36 
  37 #include "java_io_FileInputStream.h"
  38 
  39 extern jfieldID fis_fd; /* id for jobject 'fd' in java.io.FileInputStream */

  40 
  41 /*********************************************************************
  42  * Platform specific implementation of input stream native methods
  43  */
  44 
  45 JNIEXPORT void JNICALL









  46 Java_java_io_FileInputStream_close0(JNIEnv *env, jobject this) {
  47     fileClose(env, this, fis_fd);











  48 }


  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 #include <sys/types.h>
  27 #include <sys/stat.h>
  28 #include <fcntl.h>
  29 #include <unistd.h>
  30 
  31 #include "jni.h"
  32 #include "jni_util.h"
  33 #include "jvm.h"
  34 #include "io_util.h"
  35 #include "io_util_md.h"
  36 
  37 #include "java_io_FileInputStream.h"
  38 
  39 extern jfieldID fis_fd; /* id for jobject 'fd' in java.io.FileInputStream */
  40 extern jfieldID fis_pgsz; /* id for jobject 'pageSize' in java.io.FileInputStream */
  41 
  42 /*********************************************************************
  43  * Platform specific implementation of input stream native methods
  44  */
  45 
  46 JNIEXPORT void JNICALL
  47 Java_java_io_FileInputStream_open0(JNIEnv *env, jobject this, jstring path, jboolean direct) {
  48     if (direct) {
  49         fileOpen(env, this, path, fis_fd, O_RDONLY | O_DIRECT);
  50     } else {
  51         fileOpen(env, this, path, fis_fd, O_RDONLY);
  52     }
  53 }
  54 
  55 JNIEXPORT void JNICALL
  56 Java_java_io_FileInputStream_close0(JNIEnv *env, jobject this) {
  57     fileClose(env, this, fis_fd);
  58 }
  59 
  60 JNIEXPORT jint JNICALL
  61 Java_java_io_FileInputStream_readBytesD(JNIEnv *env, jobject this,
  62         jbyteArray bytes, jint off, jint len) {
  63     return readBytesD(env, this, bytes, off, len, fis_fd, fis_pgsz);
  64 }
  65 
  66 JNIEXPORT jint JNICALL
  67 Java_java_io_FileInputStream_getPageSize0(JNIEnv *env, jobject this) {
  68     return getpagesize();
  69 }
< prev index next >