src/solaris/native/java/io/FileOutputStream_md.c

Print this page
rev 10457 : 8054720: Modifications of I/O methods for instrumentation purposes
Summary: Wrap some native methods in Java methods and change native method names to a consistent form.
Reviewed-by: TBD


  36 /*******************************************************************/
  37 /*  BEGIN JNI ********* BEGIN JNI *********** BEGIN JNI ************/
  38 /*******************************************************************/
  39 
  40 jfieldID fos_fd; /* id for jobject 'fd' in java.io.FileOutputStream */
  41 
  42 /**************************************************************
  43  * static methods to store field ID's in initializers
  44  */
  45 
  46 JNIEXPORT void JNICALL
  47 Java_java_io_FileOutputStream_initIDs(JNIEnv *env, jclass fdClass) {
  48     fos_fd = (*env)->GetFieldID(env, fdClass, "fd", "Ljava/io/FileDescriptor;");
  49 }
  50 
  51 /**************************************************************
  52  * Output stream
  53  */
  54 
  55 JNIEXPORT void JNICALL
  56 Java_java_io_FileOutputStream_open(JNIEnv *env, jobject this,
  57                                    jstring path, jboolean append) {
  58     fileOpen(env, this, path, fos_fd,
  59              O_WRONLY | O_CREAT | (append ? O_APPEND : O_TRUNC));
  60 }
  61 
  62 JNIEXPORT void JNICALL
  63 Java_java_io_FileOutputStream_write(JNIEnv *env, jobject this, jint byte, jboolean append) {
  64     writeSingle(env, this, byte, append, fos_fd);
  65 }
  66 
  67 JNIEXPORT void JNICALL
  68 Java_java_io_FileOutputStream_writeBytes(JNIEnv *env,
  69     jobject this, jbyteArray bytes, jint off, jint len, jboolean append) {
  70     writeBytes(env, this, bytes, off, len, append, fos_fd);
  71 }
  72 
  73 JNIEXPORT void JNICALL
  74 Java_java_io_FileOutputStream_close0(JNIEnv *env, jobject this) {
  75     fileClose(env, this, fos_fd);
  76 }


  36 /*******************************************************************/
  37 /*  BEGIN JNI ********* BEGIN JNI *********** BEGIN JNI ************/
  38 /*******************************************************************/
  39 
  40 jfieldID fos_fd; /* id for jobject 'fd' in java.io.FileOutputStream */
  41 
  42 /**************************************************************
  43  * static methods to store field ID's in initializers
  44  */
  45 
  46 JNIEXPORT void JNICALL
  47 Java_java_io_FileOutputStream_initIDs(JNIEnv *env, jclass fdClass) {
  48     fos_fd = (*env)->GetFieldID(env, fdClass, "fd", "Ljava/io/FileDescriptor;");
  49 }
  50 
  51 /**************************************************************
  52  * Output stream
  53  */
  54 
  55 JNIEXPORT void JNICALL
  56 Java_java_io_FileOutputStream_open0(JNIEnv *env, jobject this,
  57                                     jstring path, jboolean append) {
  58     fileOpen(env, this, path, fos_fd,
  59              O_WRONLY | O_CREAT | (append ? O_APPEND : O_TRUNC));
  60 }
  61 
  62 JNIEXPORT void JNICALL
  63 Java_java_io_FileOutputStream_write(JNIEnv *env, jobject this, jint byte, jboolean append) {
  64     writeSingle(env, this, byte, append, fos_fd);
  65 }
  66 
  67 JNIEXPORT void JNICALL
  68 Java_java_io_FileOutputStream_writeBytes(JNIEnv *env,
  69     jobject this, jbyteArray bytes, jint off, jint len, jboolean append) {
  70     writeBytes(env, this, bytes, off, len, append, fos_fd);
  71 }
  72 
  73 JNIEXPORT void JNICALL
  74 Java_java_io_FileOutputStream_close0(JNIEnv *env, jobject this) {
  75     fileClose(env, this, fos_fd);
  76 }