27 delegate
void __jniDelegate__open0(IntPtr jniEnv, IntPtr this_, IntPtr path, sbyte append);
31 delegate
void __jniDelegate__writeBytes(IntPtr jniEnv, IntPtr this_, IntPtr bytes,
int off,
int len, sbyte append);
44 public static void open0(
object this_,
string path,
bool append)
47 throw new NotImplementedException();
49 if (
JVM.Vfs.IsPath(path))
53 var fd = FileOutputStreamAccessor.GetFd(this_);
55 throw new global::java.io.IOException(
"The handle is invalid.");
57 FileDescriptorAccessor.SetPtr(fd, -1);
58 FileDescriptorAccessor.SetStream(fd,
JVM.Vfs.Open(path, append ? FileMode.Append : FileMode.Create, FileAccess.Write));
60 catch (ObjectDisposedException e)
62 throw new global::java.io.IOException(e.Message);
64 catch (ArgumentException e)
66 throw new global::java.io.FileNotFoundException(e.Message);
68 catch (SecurityException e)
70 throw new global::java.lang.SecurityException(e.Message);
72 catch (UnauthorizedAccessException)
74 throw new global::java.io.FileNotFoundException(path +
" (Access is denied)");
78 throw new global::java.io.FileNotFoundException(e.Message);
80 catch (NotSupportedException e)
82 throw new global::java.io.FileNotFoundException(e.Message);
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);
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);
99 System.Console.WriteLine(
"*** exception in native code ***");
100 System.Console.WriteLine(ex);
117 public static void write(
object self,
int byte_,
bool append)
120 throw new NotImplementedException();
122 var fd = FileOutputStreamAccessor.GetFd(
self);
124 throw new global::java.io.IOException(
"The handle is invalid.");
126 if (FileDescriptorAccessor.GetStream(fd) is Stream stream)
128 if (stream.CanWrite ==
false)
129 throw new global::java.io.IOException(
"The handle is invalid.");
133 stream.WriteByte((
byte)byte_);
136 catch (ObjectDisposedException e)
138 throw new global::java.io.IOException(e.Message);
140 catch (NotSupportedException e)
142 throw new global::java.io.IOException(e.Message);
144 catch (IOException e)
146 throw new global::java.io.IOException(e.Message);
151 __callerID ??= global::ikvm.@
internal.CallerID.create(typeof(global::java.io.FileOutputStream).TypeHandle);
152 __jniPtr__write ??= Marshal.GetDelegateForFunctionPointer<__jniDelegate__write>(
JNIFrame.
GetFuncPtr(__callerID,
"java/io/FileOutputStream", nameof(
write),
"(IZ)V"));
154 var jniEnv = jniFrm.Enter(__callerID);
157 var selfRef = jniFrm.MakeLocalRef(
self);
158 __jniPtr__write(jniEnv, selfRef, byte_, append ?
JNIEnv.JNI_TRUE :
JNIEnv.JNI_FALSE);
162 System.Console.WriteLine(
"*** exception in native code ***");
163 System.Console.WriteLine(ex);
182 public static void writeBytes(
object self,
byte[] bytes,
int off,
int len,
bool append)
185 throw new NotImplementedException();
187 var fd = FileOutputStreamAccessor.GetFd(
self);
189 throw new global::java.io.IOException(
"The handle is invalid.");
191 if (FileDescriptorAccessor.GetStream(fd) is Stream stream)
193 if ((off < 0) || (off > bytes.Length) || (len < 0) || (len > (bytes.Length - off)))
194 throw new global::java.lang.IndexOutOfBoundsException();
196 if (stream.CanWrite ==
false)
197 throw new global::java.io.IOException(
"The handle is invalid.");
201 stream.Write(bytes, off, len);
204 catch (ObjectDisposedException e)
206 throw new global::java.io.IOException(e.Message);
208 catch (NotSupportedException e)
210 throw new global::java.io.IOException(e.Message);
212 catch (IOException e)
214 throw new global::java.io.IOException(e.Message);
219 __callerID ??= global::ikvm.@
internal.CallerID.create(typeof(global::java.io.FileOutputStream).TypeHandle);
220 __jniPtr__writeBytes ??= Marshal.GetDelegateForFunctionPointer<__jniDelegate__writeBytes>(
JNIFrame.
GetFuncPtr(__callerID,
"java/io/FileOutputStream", nameof(
writeBytes),
"([BIIZ)V"));
222 var jniEnv = jniFrm.Enter(__callerID);
225 __jniPtr__writeBytes(jniEnv, jniFrm.MakeLocalRef(
self), jniFrm.MakeLocalRef(bytes), off, len, append ?
JNIEnv.JNI_TRUE :
JNIEnv.JNI_FALSE);
229 System.Console.WriteLine(
"*** exception in native code ***");
230 System.Console.WriteLine(ex);
248 throw new NotImplementedException();
250 var fd = FileOutputStreamAccessor.GetFd(this_);
252 throw new global::java.io.IOException(
"The handle is invalid.");
254 if (FileDescriptorAccessor.GetStream(fd) is Stream stream)
259 FileDescriptorAccessor.SetPtr(fd, -1);
268 __callerID ??= global::ikvm.@
internal.CallerID.create(typeof(global::java.io.FileOutputStream).TypeHandle);
269 __jniPtr__close0 ??= Marshal.GetDelegateForFunctionPointer<__jniDelegate__close0>(
JNIFrame.
GetFuncPtr(__callerID,
"java/io/FileOutputStream", nameof(
close0),
"()V"));
271 var jniEnv = jniFrm.Enter(__callerID);
274 __jniPtr__close0(jniEnv, jniFrm.MakeLocalRef(this_));
278 System.Console.WriteLine(
"*** exception in native code ***");
279 System.Console.WriteLine(ex);