1 // -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
2 // ---------------------------------------------------------------------------
4 // Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
5 // ---------------------------------------------------------------------------
6 // SquirrelJME is under the GNU General Public License v3+, or later.
7 // See license.mkd for licensing and copyright information.
8 // ---------------------------------------------------------------------------
10 package cc
.squirreljme
.jvm
.mle
;
12 import cc
.squirreljme
.jvm
.mle
.constants
.BuiltInEncodingType
;
13 import cc
.squirreljme
.jvm
.mle
.constants
.BuiltInLocaleType
;
14 import cc
.squirreljme
.jvm
.mle
.constants
.ByteOrderType
;
15 import cc
.squirreljme
.jvm
.mle
.constants
.LineEndingType
;
16 import cc
.squirreljme
.jvm
.mle
.constants
.MemoryProfileType
;
17 import cc
.squirreljme
.jvm
.mle
.constants
.PhoneModelType
;
18 import cc
.squirreljme
.jvm
.mle
.constants
.VMDescriptionType
;
19 import cc
.squirreljme
.jvm
.mle
.constants
.VMStatisticType
;
20 import cc
.squirreljme
.jvm
.mle
.constants
.VMType
;
21 import cc
.squirreljme
.jvm
.mle
.exceptions
.MLECallError
;
22 import cc
.squirreljme
.runtime
.cldc
.annotation
.Api
;
25 * Run-time shelf which contains system information.
30 public final class RuntimeShelf
37 private RuntimeShelf()
42 * Returns the byte order of the system.
44 * @return The {@link ByteOrderType} of the system.
48 public static native int byteOrder();
51 * Returns the current time in milliseconds since UTC.
53 * @return The current time in milliseconds since UTC.
57 public static native long currentTimeMillis();
60 * Returns the encoding of the system.
62 * @return The encoding of the system, see {@link BuiltInEncodingType}.
63 * @see BuiltInEncodingType
67 public static native int encoding();
70 * Exits the virtual machine.
72 * @param __code The exit code.
76 public static native void exit(int __code
);
79 * Suggests that garbage collection be done, this may happen now, in
80 * the future, or never as it is not defined.
85 public static native void garbageCollect();
88 * Returns the line ending type of the system.
90 * @return The line ending type of the system, see {@link LineEndingType}.
95 public static native int lineEnding();
98 * The built-in locate to use.
100 * @return The built-in locale, see {@link BuiltInLocaleType}.
101 * @see BuiltInLocaleType
104 @SquirrelJMEVendorApi
105 public static native int locale();
108 * The memory profile of the system, should it go out of its way to
109 * conserve extra memory at a performance cost?
111 * @return The {@link MemoryProfileType} of the system.
114 @SquirrelJMEVendorApi
115 public static native int memoryProfile();
118 * Returns the number of monotonic nanoseconds that have elapsed.
120 * @return The monotonic nanosecond clock.
123 @SquirrelJMEVendorApi
124 public static native long nanoTime();
127 * Returns the phone model that SquirrelJME is simulating itself as.
129 * @return The {@link PhoneModelType}.
132 @SquirrelJMEVendorApi
133 public static native int phoneModel();
136 * Returns the value of a system environment variable.
138 * Not every platform and/or system may have these, so these should not
141 * @param __key The environment variable key.
142 * @return The value of the variable if it is set, otherwise {@code null}.
143 * @throws MLECallError If key is {@code null}.
146 @SquirrelJMEVendorApi
147 public static native String
systemEnv(String __key
)
151 * Returns the system property for the given key, if there is one.
153 * @param __key The property key.
154 * @return The value of the system property or {@code null}.
155 * @throws MLECallError If {@code __key} is {@code null}.
158 @SquirrelJMEVendorApi
159 public static native String
systemProperty(String __key
)
163 * Returns a special virtual machine description.
165 * @param __type The {@link VMDescriptionType}.
166 * @return The string for the given description or {@code null} if not
168 * @throws MLECallError If {@code __type} is not valid.
171 @SquirrelJMEVendorApi
172 public static native String
vmDescription(int __type
)
176 * Returns a statistic of the virtual machine.
178 * @param __type The {@link VMStatisticType}.
179 * @return The value of the statistic, or {@code 0L} if not set.
180 * @throws MLECallError If {@code __type} is not valid.
183 @SquirrelJMEVendorApi
184 public static native long vmStatistic(int __type
)
188 * Returns the current {@link VMType}.
190 * @return The current {@link VMType}.
193 @SquirrelJMEVendorApi
194 public static native int vmType();