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
;
23 import cc
.squirreljme
.runtime
.cldc
.annotation
.SquirrelJMEVendorApi
;
26 * Run-time shelf which contains system information.
31 public final class RuntimeShelf
38 private RuntimeShelf()
43 * Returns the byte order of the system.
45 * @return The {@link ByteOrderType} of the system.
49 public static native int byteOrder();
52 * Returns the current time in milliseconds since UTC.
54 * @return The current time in milliseconds since UTC.
58 public static native long currentTimeMillis();
61 * Returns the encoding of the system.
63 * @return The encoding of the system, see {@link BuiltInEncodingType}.
64 * @see BuiltInEncodingType
68 public static native int encoding();
71 * Exits the virtual machine.
73 * @param __code The exit code.
77 public static native void exit(int __code
);
80 * Suggests that garbage collection be done, this may happen now, in
81 * the future, or never as it is not defined.
86 public static native void garbageCollect();
89 * Returns the line ending type of the system.
91 * @return The line ending type of the system, see {@link LineEndingType}.
96 public static native int lineEnding();
99 * The built-in locate to use.
101 * @return The built-in locale, see {@link BuiltInLocaleType}.
102 * @see BuiltInLocaleType
105 @SquirrelJMEVendorApi
106 public static native int locale();
109 * The memory profile of the system, should it go out of its way to
110 * conserve extra memory at a performance cost?
112 * @return The {@link MemoryProfileType} of the system.
115 @SquirrelJMEVendorApi
116 public static native int memoryProfile();
119 * Returns the number of monotonic nanoseconds that have elapsed.
121 * @return The monotonic nanosecond clock.
124 @SquirrelJMEVendorApi
125 public static native long nanoTime();
128 * Returns the phone model that SquirrelJME is simulating itself as.
130 * @return The {@link PhoneModelType}.
133 @SquirrelJMEVendorApi
134 public static native int phoneModel();
137 * Returns the value of a system environment variable.
139 * Not every platform and/or system may have these, so these should not
142 * @param __key The environment variable key.
143 * @return The value of the variable if it is set, otherwise {@code null}.
144 * @throws MLECallError If key is {@code null}.
147 @SquirrelJMEVendorApi
148 public static native String
systemEnv(String __key
)
152 * Returns the system property for the given key, if there is one.
154 * @param __key The property key.
155 * @return The value of the system property or {@code null}.
156 * @throws MLECallError If {@code __key} is {@code null}.
159 @SquirrelJMEVendorApi
160 public static native String
systemProperty(String __key
)
164 * Returns a special virtual machine description.
166 * @param __type The {@link VMDescriptionType}.
167 * @return The string for the given description or {@code null} if not
169 * @throws MLECallError If {@code __type} is not valid.
172 @SquirrelJMEVendorApi
173 public static native String
vmDescription(int __type
)
177 * Returns a statistic of the virtual machine.
179 * @param __type The {@link VMStatisticType}.
180 * @return The value of the statistic, or {@code 0L} if not set.
181 * @throws MLECallError If {@code __type} is not valid.
184 @SquirrelJMEVendorApi
185 public static native long vmStatistic(int __type
)
189 * Returns the current {@link VMType}.
191 * @return The current {@link VMType}.
194 @SquirrelJMEVendorApi
195 public static native int vmType();