49 public static void open0(
object self,
string path)
52 throw new NotImplementedException();
54 if (
JVM.Vfs.IsPath(path))
58 var fd = FileInputStreamAccessor.GetFd(
self);
60 throw new global::java.io.IOException(
"The handle is invalid.");
62 FileDescriptorAccessor.SetPtr(fd, -1);
63 FileDescriptorAccessor.SetStream(fd,
JVM.Vfs.Open(path, FileMode.Open, FileAccess.Read));
65 catch (ObjectDisposedException e)
67 throw new global::java.io.IOException(e.Message);
69 catch (ArgumentException e)
71 throw new global::java.io.FileNotFoundException(e.Message);
73 catch (SecurityException e)
75 throw new global::java.lang.SecurityException(e.Message);
77 catch (UnauthorizedAccessException)
79 throw new global::java.io.FileNotFoundException(path +
" (Access is denied)");
83 throw new global::java.io.FileNotFoundException(e.Message);
85 catch (NotSupportedException e)
87 throw new global::java.io.FileNotFoundException(e.Message);
92 __callerID ??= global::ikvm.@
internal.CallerID.create(typeof(global::java.io.FileInputStream).TypeHandle);
93 __jniPtr__open0 ??= Marshal.GetDelegateForFunctionPointer<__jniDelegate__open0>(
JNIFrame.
GetFuncPtr(__callerID,
"java/io/FileInputStream", nameof(
open0),
"(Ljava/lang/String;)V"));
95 var jniEnv = jniFrm.Enter(__callerID);
98 __jniPtr__open0(jniEnv, jniFrm.MakeLocalRef(
self), jniFrm.MakeLocalRef(path));
102 System.Console.WriteLine(
"*** exception in native code ***");
103 System.Console.WriteLine(ex);
119 public static int read0(
object self)
122 throw new NotImplementedException();
124 var fd = FileInputStreamAccessor.GetFd(
self);
126 throw new global::java.io.IOException(
"The handle is invalid.");
128 if (FileDescriptorAccessor.GetStream(fd) is Stream stream)
130 if (stream.CanRead ==
false)
131 throw new global::java.io.IOException(
"Read failed.");
135 return stream.ReadByte();
137 catch (ObjectDisposedException e)
139 throw new global::java.io.IOException(e.Message);
141 catch (NotSupportedException e)
143 throw new global::java.io.IOException(e.Message);
145 catch (IOException e)
147 throw new global::java.io.IOException(e.Message);
152 __callerID ??= global::ikvm.@
internal.CallerID.create(typeof(global::java.io.FileInputStream).TypeHandle);
153 __jniPtr__read0 ??= Marshal.GetDelegateForFunctionPointer<__jniDelegate__read0>(
JNIFrame.
GetFuncPtr(__callerID,
"java/io/FileInputStream", nameof(
read0),
"()I"));
155 var jniEnv = jniFrm.Enter(__callerID);
158 return __jniPtr__read0(jniEnv, jniFrm.MakeLocalRef(
self));
162 System.Console.WriteLine(
"*** exception in native code ***");
163 System.Console.WriteLine(ex);
182 public static int readBytes(
object self,
byte[] bytes,
int off,
int len)
185 throw new NotImplementedException();
187 var fd = FileInputStreamAccessor.GetFd(
self);
189 throw new global::java.io.IOException(
"The handle is invalid.");
191 if (FileDescriptorAccessor.GetStream(fd) is Stream stream)
196 if ((off < 0) || (off > bytes.Length) || (len < 0) || (len > (bytes.Length - off)))
197 throw new global::java.lang.IndexOutOfBoundsException();
199 if (stream.CanRead ==
false)
200 throw new global::java.io.IOException(
"Read failed.");
204 var n = stream.Read(bytes, off, len);
205 return n == 0 ? -1 : n;
207 catch (ObjectDisposedException e)
209 throw new global::java.io.IOException(e.Message);
211 catch (NotSupportedException e)
213 throw new global::java.io.IOException(e.Message);
215 catch (IOException e)
217 throw new global::java.io.IOException(e.Message);
222 __callerID ??= global::ikvm.@
internal.CallerID.create(typeof(global::java.io.FileInputStream).TypeHandle);
223 __jniPtr__readBytes ??= Marshal.GetDelegateForFunctionPointer<__jniDelegate__readBytes>(
JNIFrame.
GetFuncPtr(__callerID,
"java/io/FileInputStream", nameof(
readBytes),
"([BII)I"));
225 var jniEnv = jniFrm.Enter(__callerID);
228 return __jniPtr__readBytes(jniEnv, jniFrm.MakeLocalRef(
self), jniFrm.MakeLocalRef(bytes), off, len);
232 System.Console.WriteLine(
"*** exception in native code ***");
233 System.Console.WriteLine(ex);
250 public static long skip0(
object self,
long n)
253 throw new NotImplementedException();
255 var fd = FileInputStreamAccessor.GetFd(
self);
257 throw new global::java.io.IOException(
"The handle is invalid.");
259 if (FileDescriptorAccessor.GetStream(fd) is Stream stream)
261 if (stream.CanSeek ==
false)
262 throw new global::java.io.IOException(
"The handle is invalid.");
266 long cur = stream.Position;
267 long end = stream.Seek(n, SeekOrigin.Current);
270 catch (ObjectDisposedException e)
272 throw new global::java.io.IOException(e.Message);
274 catch (NotSupportedException e)
276 throw new global::java.io.IOException(e.Message);
278 catch (IOException e)
280 throw new global::java.io.IOException(e.Message);
285 __callerID ??= global::ikvm.@
internal.CallerID.create(typeof(global::java.io.FileInputStream).TypeHandle);
286 __jniPtr__skip0 ??= Marshal.GetDelegateForFunctionPointer<__jniDelegate__skip>(
JNIFrame.
GetFuncPtr(__callerID,
"java/io/FileInputStream", nameof(
skip0),
"(J)J"));
288 var jniEnv = jniFrm.Enter(__callerID);
291 return __jniPtr__skip0(jniEnv, jniFrm.MakeLocalRef(
self), n);
295 System.Console.WriteLine(
"*** exception in native code ***");
296 System.Console.WriteLine(ex);
315 throw new NotImplementedException();
317 var fd = FileInputStreamAccessor.GetFd(
self);
319 throw new global::java.io.IOException(
"The handle is invalid.");
321 if (FileDescriptorAccessor.GetStream(fd) is Stream stream)
323 if (stream.CanSeek ==
false)
328 return (
int)Math.Min(
int.MaxValue, Math.Max(0, stream.Length - stream.Position));
330 catch (ObjectDisposedException e)
332 throw new global::java.io.IOException(e.Message);
334 catch (NotSupportedException e)
336 throw new global::java.io.IOException(e.Message);
338 catch (IOException e)
340 throw new global::java.io.IOException(e.Message);
345 __callerID ??= global::ikvm.@
internal.CallerID.create(typeof(global::java.io.FileInputStream).TypeHandle);
346 __jniPtr__available0 ??= Marshal.GetDelegateForFunctionPointer<__jniDelegate__available>(
JNIFrame.
GetFuncPtr(__callerID,
"java/io/FileInputStream", nameof(
available0),
"()I"));
348 var jniEnv = jniFrm.Enter(__callerID);
351 return __jniPtr__available0(jniEnv, jniFrm.MakeLocalRef(
self));
355 System.Console.WriteLine(
"*** exception in native code ***");
356 System.Console.WriteLine(ex);
374 throw new NotImplementedException();
376 var fd = FileInputStreamAccessor.GetFd(
self);
378 throw new global::java.io.IOException(
"The handle is invalid.");
380 if (FileDescriptorAccessor.GetStream(fd) is Stream stream)
385 FileDescriptorAccessor.SetPtr(fd, -1);
394 __callerID ??= global::ikvm.@
internal.CallerID.create(typeof(global::java.io.FileInputStream).TypeHandle);
395 __jniPtr__close0 ??= Marshal.GetDelegateForFunctionPointer<__jniDelegate__close0>(
JNIFrame.
GetFuncPtr(__callerID,
"java/io/FileInputStream", nameof(
close0),
"()V"));
397 var jniEnv = jniFrm.Enter(__callerID);
400 __jniPtr__close0(jniEnv, jniFrm.MakeLocalRef(
self));
404 System.Console.WriteLine(
"*** exception in native code ***");
405 System.Console.WriteLine(ex);