src/windows/native/java/io/io_util_md.h

Print this page




  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 #include "jni.h"
  27 #include "jni_util.h"
  28 
  29 /*
  30  * Prototypes for functions in io_util_md.c called from io_util,
  31  * FileDescriptor.c, FileInputStream.c, FileOutputStream.c
  32  */
  33 WCHAR* pathToNTPath(JNIEnv *env, jstring path, jboolean throwFNFE);
  34 WCHAR* fileToNTPath(JNIEnv *env, jobject file, jfieldID id);
  35 WCHAR* getPrefixed(const WCHAR* path, int pathlen);
  36 WCHAR* currentDir(int di);
  37 int currentDirLength(const WCHAR* path, int pathlen);
  38 void fileOpen(JNIEnv *env, jobject this, jstring path, jfieldID fid, int flags);
  39 int handleAvailable(jlong fd, jlong *pbytes);
  40 JNIEXPORT int handleSync(jlong fd);
  41 int handleSetLength(jlong fd, jlong length);
  42 JNIEXPORT size_t handleRead(jlong fd, void *buf, jint len);
  43 JNIEXPORT size_t handleWrite(jlong fd, const void *buf, jint len);
  44 JNIEXPORT size_t handleAppend(jlong fd, const void *buf, jint len);
  45 jint handleClose(JNIEnv *env, jobject this, jfieldID fid);
  46 jlong handleLseek(jlong fd, jlong offset, jint whence);
  47 
  48 /*
  49  * Returns an opaque handle to file named by "path".  If an error occurs,
  50  * returns -1 and an exception is pending.
  51  */
  52 jlong winFileHandleOpen(JNIEnv *env, jstring path, int flags);
  53 
  54 /*
  55  * Macros to use the right data type for file descriptors
  56  */
  57 #define FD jlong
  58 
  59 /*
  60  * Macros to set/get fd from the java.io.FileDescriptor.
  61  * If GetObjectField returns null, SET_FD will stop and GET_FD
  62  * will simply return -1 to avoid crashing VM.
  63  */
  64 #define SET_FD(this, fd, fid) \




  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 #include "jni.h"
  27 #include "jni_util.h"
  28 
  29 /*
  30  * Prototypes for functions in io_util_md.c called from io_util,
  31  * FileDescriptor.c, FileInputStream.c, FileOutputStream.c
  32  */
  33 WCHAR* pathToNTPath(JNIEnv *env, jstring path, jboolean throwFNFE);
  34 WCHAR* fileToNTPath(JNIEnv *env, jobject file, jfieldID id);
  35 WCHAR* getPrefixed(const WCHAR* path, int pathlen);
  36 WCHAR* currentDir(int di);
  37 int currentDirLength(const WCHAR* path, int pathlen);
  38 void fileOpen(JNIEnv *env, jobject this, jstring path, jfieldID fid, int flags);
  39 int handleAvailable(jlong fd, jlong *pbytes);
  40 JNIEXPORT int handleSync(jlong fd);
  41 int handleSetLength(jlong fd, jlong length);
  42 JNIEXPORT jint handleRead(jlong fd, void *buf, jint len);
  43 JNIEXPORT jint handleWrite(jlong fd, const void *buf, jint len);
  44 JNIEXPORT jint handleAppend(jlong fd, const void *buf, jint len);
  45 jint handleClose(JNIEnv *env, jobject this, jfieldID fid);
  46 jlong handleLseek(jlong fd, jlong offset, jint whence);
  47 
  48 /*
  49  * Returns an opaque handle to file named by "path".  If an error occurs,
  50  * returns -1 and an exception is pending.
  51  */
  52 jlong winFileHandleOpen(JNIEnv *env, jstring path, int flags);
  53 
  54 /*
  55  * Macros to use the right data type for file descriptors
  56  */
  57 #define FD jlong
  58 
  59 /*
  60  * Macros to set/get fd from the java.io.FileDescriptor.
  61  * If GetObjectField returns null, SET_FD will stop and GET_FD
  62  * will simply return -1 to avoid crashing VM.
  63  */
  64 #define SET_FD(this, fd, fid) \