java :: NativeInputStream :: available
java :: NativeInputStream :: close
java :: NativeInputStream :: defaultinit
java $ NativeInputStream :: SELF
Type of this instance, automatically specialized in every classjava $ NativeInputStream :: pop_from_local_frame_with_env
Java implementation ofpop_from_local_frame
core :: Pointer :: address_is_null
Is the address behind this Object at NULL?java :: NativeInputStream :: available
core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
java :: NativeInputStream :: close
jvm :: JavaObject :: defaultinit
core :: Object :: defaultinit
core :: Pointer :: defaultinit
java :: NativeInputStream :: defaultinit
core :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
jvm :: JavaObject :: new_global_ref
Returns a global reference to the Java object behind this referencecore :: Object :: output_class_name
Display class name on stdout (debug only).jvm :: JavaObject :: pop_from_local_frame
Pops the current local reference frame and return a valid reference to selfjvm :: JavaObject :: pop_from_local_frame_with_env
Java implementation ofpop_from_local_frame
jvm :: JavaObject :: to_java_string
JavaString
representation of self
using Java's toString
extern class NativeInputStream in "Java" `{ java.io.InputStream `}
super JavaObject
fun available: Int in "Java" `{
try {
return self.available();
}catch(IOException e){
e.printStackTrace();
return -1;
}
`}
fun close in "Java" `{
try {
self.close();
}catch(IOException e){
e.printStackTrace();
}
`}
# HACK for bug #845
redef fun new_global_ref import sys, Sys.jni_env `{
Sys sys = NativeInputStream_sys(self);
JNIEnv *env = Sys_jni_env(sys);
return (*env)->NewGlobalRef(env, self);
`}
redef fun pop_from_local_frame_with_env(jni_env) `{
return (*jni_env)->PopLocalFrame(jni_env, self);
`}
end
lib/java/io.nit:152,1--182,3
redef class NativeInputStream
# Read and return all the content of this stream
private fun read_all: JavaString in "Java" `{
// `available` returns the n of bytes currently available, not the total.
// This may cause problems in the future with large asset files.
try {
int size = self.available();
byte[] bytes = new byte[size];
self.read(bytes, 0, size);
return new String(bytes);
} catch (java.lang.Exception exception) {
exception.printStackTrace();
return null;
}
`}
end
lib/android/assets.nit:53,1--70,3