# A native C array, as in a pointer to the first element of the array
extern class NativeCArray `{ void * `}
type E: nullable Object
- type SELF: NativeCArray
fun [](index: E): E is abstract
fun []=(index: E, val: E) is abstract
extern class NativeCIntArray `{ int* `}
super NativeCArray
redef type E: Int
- redef type SELF: NativeCIntArray
new(size: Int) `{ return calloc(size, sizeof(int)); `}
redef fun [](index) `{ return recv[index]; `}
redef class NativeString
super NativeCArray
redef type E: Char
- redef type SELF: NativeString
redef fun +(offset) `{ return recv + offset; `}
end
extern class NativeFile in "Java" `{ java.io.File `}
super JavaObject
- redef type SELF: NativeFile
fun can_execute: Bool in "Java" `{ return recv.canExecute(); `}
fun can_read: Bool in "Java" `{ return recv.canRead(); `}
extern class NativeFileInputStream in "Java" `{ java.io.FileInputStream `}
super JavaObject
- redef type SELF: NativeFileInputStream
fun available: Int in "Java" `{
try {
extern class NativeFileOutputStream in "Java" `{ java.io.FileOutputStream `}
super JavaObject
- redef type SELF: NativeFileOutputStream
fun close in "Java" `{
try {
extern class NativeFileDescriptor in "Java" `{ java.io.FileDescriptor `}
super JavaObject
- redef type SELF: NativeFileDescriptor
+
fun sync in "Java" `{
try{
recv.sync();
extern class NativeInputStream in "Java" `{ java.io.InputStream `}
super JavaObject
- redef type SELF: NativeInputStream
fun available: Int in "Java" `{
try {
extern class JavaString in "Java" `{ java.lang.String `}
super JavaObject
- redef type SELF: JavaString
-
# Get the string from Java and copy it to Nit memory
fun to_cstring: NativeString import sys, Sys.jni_env `{
Sys sys = JavaString_sys(recv);
end
redef extern class JavaObject
- type SELF: JavaObject
# Returns a global reference to the Java object behind this reference
#
-Runtime error: Assert failed (../lib/c.nit:64)
+Runtime error: Assert failed (../lib/c.nit:63)
-Runtime error: Assert failed (../lib/c.nit:57)
+Runtime error: Assert failed (../lib/c.nit:56)
0
-Runtime error: Assert failed (../lib/c.nit:57)
+Runtime error: Assert failed (../lib/c.nit:56)
0
-Runtime error: Assert failed (../lib/c.nit:56)
+Runtime error: Assert failed (../lib/c.nit:55)
0
0
1