< prev index next >

src/java.base/share/native/libjava/io_util.h

Print this page


   1 /*
   2  * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  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


  37 #endif
  38 #ifndef O_DSYNC
  39 #define O_DSYNC O_FSYNC
  40 #endif
  41 #elif !defined(O_DSYNC) || !defined(O_SYNC)
  42 #define O_SYNC  (0x0800)
  43 #define O_DSYNC (0x2000)
  44 #endif
  45 
  46 /*
  47  * IO helper functions
  48  */
  49 
  50 jint readSingle(JNIEnv *env, jobject this, jfieldID fid);
  51 jint readBytes(JNIEnv *env, jobject this, jbyteArray bytes, jint off,
  52                jint len, jfieldID fid);
  53 void writeSingle(JNIEnv *env, jobject this, jint byte, jboolean append, jfieldID fid);
  54 void writeBytes(JNIEnv *env, jobject this, jbyteArray bytes, jint off,
  55                 jint len, jboolean append, jfieldID fid);
  56 void fileOpen(JNIEnv *env, jobject this, jstring path, jfieldID fid, int flags);
  57 void throwFileNotFoundException(JNIEnv *env, jstring path);

  58 
  59 /*
  60  * Macros for managing platform strings.  The typical usage pattern is:
  61  *
  62  *     WITH_PLATFORM_STRING(env, string, var) {
  63  *         doSomethingWith(var);
  64  *     } END_PLATFORM_STRING(env, var);
  65  *
  66  *  where  env      is the prevailing JNIEnv,
  67  *         string   is a JNI reference to a java.lang.String object, and
  68  *         var      is the char * variable that will point to the string,
  69  *                  after being converted into the platform encoding.
  70  *
  71  * The related macro WITH_FIELD_PLATFORM_STRING first extracts the string from
  72  * a given field of a given object:
  73  *
  74  *     WITH_FIELD_PLATFORM_STRING(env, object, id, var) {
  75  *         doSomethingWith(var);
  76  *     } END_PLATFORM_STRING(env, var);
  77  *


   1 /*
   2  * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  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


  37 #endif
  38 #ifndef O_DSYNC
  39 #define O_DSYNC O_FSYNC
  40 #endif
  41 #elif !defined(O_DSYNC) || !defined(O_SYNC)
  42 #define O_SYNC  (0x0800)
  43 #define O_DSYNC (0x2000)
  44 #endif
  45 
  46 /*
  47  * IO helper functions
  48  */
  49 
  50 jint readSingle(JNIEnv *env, jobject this, jfieldID fid);
  51 jint readBytes(JNIEnv *env, jobject this, jbyteArray bytes, jint off,
  52                jint len, jfieldID fid);
  53 void writeSingle(JNIEnv *env, jobject this, jint byte, jboolean append, jfieldID fid);
  54 void writeBytes(JNIEnv *env, jobject this, jbyteArray bytes, jint off,
  55                 jint len, jboolean append, jfieldID fid);
  56 void fileOpen(JNIEnv *env, jobject this, jstring path, jfieldID fid, int flags);
  57 JNIEXPORT void JNICALL
  58 throwFileNotFoundException(JNIEnv *env, jstring path);
  59 
  60 /*
  61  * Macros for managing platform strings.  The typical usage pattern is:
  62  *
  63  *     WITH_PLATFORM_STRING(env, string, var) {
  64  *         doSomethingWith(var);
  65  *     } END_PLATFORM_STRING(env, var);
  66  *
  67  *  where  env      is the prevailing JNIEnv,
  68  *         string   is a JNI reference to a java.lang.String object, and
  69  *         var      is the char * variable that will point to the string,
  70  *                  after being converted into the platform encoding.
  71  *
  72  * The related macro WITH_FIELD_PLATFORM_STRING first extracts the string from
  73  * a given field of a given object:
  74  *
  75  *     WITH_FIELD_PLATFORM_STRING(env, object, id, var) {
  76  *         doSomethingWith(var);
  77  *     } END_PLATFORM_STRING(env, var);
  78  *


< prev index next >