Implements the native method 'open0'.
45 {
46#if FIRST_PASS
47 throw new NotImplementedException();
48#else
49 if (
JVM.Vfs.IsPath(path))
50 {
51 try
52 {
53 var fd = FileOutputStreamAccessor.GetFd(this_);
54 if (fd == null)
55 throw new global::java.io.IOException("The handle is invalid.");
56
57 FileDescriptorAccessor.SetPtr(fd, -1);
58 FileDescriptorAccessor.SetStream(fd,
JVM.Vfs.Open(path, append ? FileMode.Append : FileMode.Create, FileAccess.Write));
59 }
60 catch (ObjectDisposedException e)
61 {
62 throw new global::java.io.IOException(e.Message);
63 }
64 catch (ArgumentException e)
65 {
66 throw new global::java.io.FileNotFoundException(e.Message);
67 }
68 catch (SecurityException e)
69 {
70 throw new global::java.lang.SecurityException(e.Message);
71 }
72 catch (UnauthorizedAccessException)
73 {
74 throw new global::java.io.FileNotFoundException(path + " (Access is denied)");
75 }
76 catch (IOException e)
77 {
78 throw new global::java.io.FileNotFoundException(e.Message);
79 }
80 catch (NotSupportedException e)
81 {
82 throw new global::java.io.FileNotFoundException(e.Message);
83 }
84 }
85 else
86 {
87 __callerID ??= global::ikvm.@internal.CallerID.create(typeof(global::java.io.FileOutputStream).TypeHandle);
88 __jniPtr__open0 ??= Marshal.GetDelegateForFunctionPointer<__jniDelegate__open0>(
JNIFrame.
GetFuncPtr(__callerID,
"java/io/FileOutputStream", nameof(
open0),
"(Ljava/lang/String;Z)V"));
90 var jniEnv = jniFrm.Enter(__callerID);
91 try
92 {
93 var selfRef = jniFrm.MakeLocalRef(this_);
94 var pathRef = jniFrm.MakeLocalRef(path);
95 __jniPtr__open0(jniEnv, selfRef, pathRef, append ?
JNIEnv.JNI_TRUE :
JNIEnv.JNI_FALSE);
96 }
97 catch (Exception ex)
98 {
99 System.Console.WriteLine(
"*** exception in native code ***");
100 System.Console.WriteLine(ex);
101 throw;
102 }
103 finally
104 {
105 jniFrm.Leave();
106 }
107 }
108#endif
109 }
static void open0(object this_, string path, bool append)
Implements the native method 'open0'.
Main state of the running JVM.