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
.brackets
.JarPackageBracket
;
13 import cc
.squirreljme
.jvm
.mle
.exceptions
.MLECallError
;
14 import cc
.squirreljme
.runtime
.cldc
.annotation
.Api
;
15 import java
.io
.InputStream
;
18 * This allows access to the library class path and resources.
23 public final class JarPackageShelf
26 * Returns the classpath of the current program.
28 * @return The classpath of the current program.
32 public static native JarPackageBracket
[] classPath();
35 * Checks if the given brackets refer to the same JAR.
37 * @param __a The first JAR.
38 * @param __b The second JAR.
39 * @return If these are equal or not.
40 * @throws MLECallError If either argument is {@code null}.
44 public static native boolean equals(
45 JarPackageBracket __a
, JarPackageBracket __b
)
49 * Returns the libraries which are available to the virtual machine.
51 * @return The libraries that are currently available.
55 public static native JarPackageBracket
[] libraries();
58 * Returns the path to the given JAR.
60 * Note that this may or may not be a physical path, it could be a
61 * representation of the JAR file in string form.
63 * @param __jar The JAR to get the path of.
64 * @return The path of the given JAR.
65 * @throws MLECallError If the JAR is not valid.
69 public static native String
libraryPath(JarPackageBracket __jar
)
73 * Opens the resource from the input stream.
75 * @param __jar The JAR to open.
76 * @param __rc The resource to load from the given JAR.
77 * @return Input stream to the resource, may be {@code null} if it does
79 * @throws MLECallError If the JAR is not valid or the resource was not
84 public static native InputStream
openResource(JarPackageBracket __jar
,
89 * Reads a section of a JAR representation, note that the format is not
90 * necessarily in the format of a JAR or ZIP file but may exist in SQC
93 * @param __jar The library to read the raw data from.
94 * @param __jarOffset The offset into the raw data.
95 * @param __b The buffer to write into.
96 * @param __o The offset into the buffer.
97 * @param __l The length of the buffer.
98 * @return The number of bytes read from the raw Jar data.
99 * @throws MLECallError On null arguments or if the offset and/or length
100 * exceed the array bounds.
103 @SquirrelJMEVendorApi
104 public static native int rawData(JarPackageBracket __jar
,
105 int __jarOffset
, byte[] __b
, int __o
, int __l
)
109 * Returns the raw size of a given JAR, note that this may not be
110 * the size of a JAR file but a compiled form such a SQC.
112 * @param __jar The JAR to lookup.
113 * @return The raw size of the JAR, this will be a negative value if the
114 * JAR is virtual and its size is not known.
115 * @throws MLECallError If {@code __jar} is null.
118 @SquirrelJMEVendorApi
119 public static native int rawSize(JarPackageBracket __jar
)