package_diagram java::io io java::ffi_support ffi_support java::io->java::ffi_support jvm jvm java::ffi_support->jvm ...jvm ... ...jvm->jvm android::assets_and_resources assets_and_resources android::assets_and_resources->java::io android::assets assets android::assets->android::assets_and_resources android::audio audio android::audio->android::assets_and_resources android::load_image load_image android::load_image->android::assets_and_resources android::native_notification native_notification android::native_notification->android::assets_and_resources android::assets... ... android::assets...->android::assets android::audio... ... android::audio...->android::audio android::load_image... ... android::load_image...->android::load_image android::native_notification... ... android::native_notification...->android::native_notification

Ancestors

module abstract_collection

core :: abstract_collection

Abstract collection classes and services.
module abstract_text

core :: abstract_text

Abstract class for manipulation of sequences of characters
module array

core :: array

This module introduces the standard array structure.
module bitset

core :: bitset

Services to handle BitSet
module bytes

core :: bytes

Services for byte streams and arrays
module circular_array

core :: circular_array

Efficient data structure to access both end of the sequence.
module codec_base

core :: codec_base

Base for codecs to use with streams
module codecs

core :: codecs

Group module for all codec-related manipulations
module collection

core :: collection

This module define several collection classes.
module core

core :: core

Standard classes and methods used by default by Nit programs and libraries.
module environ

core :: environ

Access to the environment variables of the process
module error

core :: error

Standard error-management infrastructure.
module exec

core :: exec

Invocation and management of operating system sub-processes.
module file

core :: file

File manipulations (create, read, write, etc.)
module fixed_ints

core :: fixed_ints

Basic integers of fixed-precision
module fixed_ints_text

core :: fixed_ints_text

Text services to complement fixed_ints
module flat

core :: flat

All the array-based text representations
module gc

core :: gc

Access to the Nit internal garbage collection mechanism
module hash_collection

core :: hash_collection

Introduce HashMap and HashSet.
module iso8859_1

core :: iso8859_1

Codec for ISO8859-1 I/O
module jvm

jvm :: jvm

Java Virtual Machine invocation API and others services from the JNI C API
module kernel

core :: kernel

Most basic classes and methods.
module list

core :: list

This module handle double linked lists
module math

core :: math

Mathematical operations
module native

core :: native

Native structures for text and bytes
module numeric

core :: numeric

Advanced services for Numeric types
module protocol

core :: protocol

module queue

core :: queue

Queuing data structures and wrappers
module range

core :: range

Module for range of discrete objects.
module re

core :: re

Regular expression support for all services based on Pattern
module ropes

core :: ropes

Tree-based representation of a String.
module sorter

core :: sorter

This module contains classes used to compare things and sorts arrays.
module stream

core :: stream

Input and output streams of characters
module text

core :: text

All the classes and methods related to the manipulation of text entities
module time

core :: time

Management of time and dates
module union_find

core :: union_find

union–find algorithm using an efficient disjoint-set data structure
module utf8

core :: utf8

Codec for UTF-8 I/O

Parents

module ffi_support

java :: ffi_support

Core supporting services for the FFI with Java

Children

module assets_and_resources

android :: assets_and_resources

Android Assets and Resources Management

Descendants

module a_star-m

a_star-m

module android19

gamnit :: android19

Variation using features from Android API 19
module assets

android :: assets

Implementation of app::assets
module audio

android :: audio

Android audio services, wraps a part of android audio API
module camera_control_android

gamnit :: camera_control_android

Two fingers camera manipulation, pinch to zoom and slide to scroll
module display_android

gamnit :: display_android

Gamnit display implementation for Android
module game

android :: game

Android services and implementation of app.nit for gamnit and mnit
module gamepad

android :: gamepad

Support for gamepad events (over Bluetooth or USB)
module gamnit_android

gamnit :: gamnit_android

Support services for Gamnit on Android
module http_request

android :: http_request

Android implementation of app:http_request
module input_events

android :: input_events

Pointer and hardware key events
module load_image

android :: load_image

Low-level services to load pixel data from the assets
module native_notification

android :: native_notification

Native Java classes for notifications
module notification

android :: notification

Services to show notification in the Android status bar
module sensors

android :: sensors

Access Android sensors
module ui

android :: ui

Views and services to use the Android native user interface
module ui_test

android :: ui_test

Test for app.nit's UI services
# Services from the `java.io` package
#
# This module is used by `android::assets_and_resources` and `android::audio`.
module io

import ffi_support

in "Java" `{
	import java.io.File;
	import java.io.FileInputStream;
	import java.io.FileOutputStream;
	import java.io.FileDescriptor;
	import java.io.IOException;
	import java.io.SyncFailedException;
`}

extern class NativeFile in "Java" `{ java.io.File `}
	super JavaObject

	fun can_execute: Bool in "Java" `{ return self.canExecute(); `}
	fun can_read: Bool in "Java" `{ return self.canRead(); `}
	fun can_write: Bool in "Java" `{ return self.canWrite(); `}
	fun create_file: Bool in "Java" `{
		try {
			return self.createNewFile();
		}catch(IOException e){
			e.printStackTrace();
			return false;
		}
	`}
	fun delete: Bool in "Java" `{ return self.delete(); `}
	fun delete_on_exit in "Java" `{ self.deleteOnExit(); `}
	fun exists: Bool in "Java" `{ return self.exists(); `}
	fun absolute_file: NativeFile in "Java" `{ return self.getAbsoluteFile(); `}
	fun absolute_path: JavaString in "Java" `{ return self.getAbsolutePath(); `}
	fun canonical_file: NativeFile in "Java" `{
		try {
			return self.getCanonicalFile();
		}catch(IOException e){
			e.printStackTrace();
			return null;
		}
	`}
	fun free_space: Int in "Java" `{ return (int)self.getFreeSpace(); `}
	fun name: JavaString in "Java" `{ return self.getName(); `}
	fun parent: JavaString in "Java" `{ return self.getParent(); `}
	fun parent_file: NativeFile in "Java" `{ return self.getParentFile(); `}
	fun path: JavaString in "Java" `{ return self.getPath(); `}
	fun total_space: Int in "Java" `{ return (int)self.getTotalSpace(); `}
	fun usable_space: Int in "Java" `{ return (int)self.getUsableSpace(); `}
	fun absolute: Bool in "Java" `{ return self.isAbsolute(); `}
	fun is_directory: Bool in "Java" `{ return self.isDirectory(); `}
	fun is_file: Bool in "Java" `{ return self.isFile(); `}
	fun is_hidden: Bool in "Java" `{ return self.isHidden(); `}
	fun last_modified: Int in "Java" `{ return (int)self.lastModified(); `}
	fun length: Int in "Java" `{ return (int)self.length(); `}
	fun set_readable(r: Bool, owner_only: Bool): Bool in "Java" `{ return self.setReadable(r, owner_only); `}
	fun set_writable(w: Bool, owner_only: Bool): Bool in "Java" `{ return self.setWritable(w, owner_only); `}
end

extern class NativeFileInputStream in "Java" `{ java.io.FileInputStream `}
	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();
		}
	`}
	fun read: Int in "Java" `{
		try {
			return self.read();
		}catch(IOException e){
			e.printStackTrace();
			return -1;
		}
	`}
	fun skip(byte_count: Int): Int in "Java" `{
		try {
			return (int)self.skip(byte_count);
		}catch(IOException e){
			e.printStackTrace();
			return -1;
		}
	`}
end

extern class NativeFileOutputStream in "Java" `{ java.io.FileOutputStream `}
	super JavaObject

	fun close in "Java" `{
		try {
			self.close();
		}catch(IOException e){
			e.printStackTrace();
		}
	`}
	fun write(one_byte: Int) in "Java" `{
		try {
			self.write((byte)one_byte);
		}catch(IOException e){
			e.printStackTrace();
		}
	`}
	fun flush in "Java" `{
		try {
			self.flush();
		}catch(IOException e){
			e.printStackTrace();
		}
	`}
end

extern class NativeFileDescriptor in "Java" `{ java.io.FileDescriptor `}
	super JavaObject

	fun sync in "Java" `{
		try{
			self.sync();
		}catch(SyncFailedException e){
			e.printStackTrace();
		}
	`}
	fun valid: Bool in "Java" `{ return self.valid(); `}
end

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:17,1--182,3