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 cc
.squirreljme
.runtime
.cldc
.annotation
.Exported
;
16 import java
.io
.InputStream
;
19 * This allows access to the library class path and resources.
24 public final class JarPackageShelf
27 * Returns the classpath of the current program.
29 * @return The classpath of the current program.
33 public static native JarPackageBracket
[] classPath();
36 * Checks if the given brackets refer to the same JAR.
38 * @param __a The first JAR.
39 * @param __b The second JAR.
40 * @return If these are equal or not.
41 * @throws MLECallError If either argument is {@code null}.
45 public static native boolean equals(
46 JarPackageBracket __a
, JarPackageBracket __b
)
50 * Returns the libraries which are available to the virtual machine.
52 * @return The libraries that are currently available.
56 public static native JarPackageBracket
[] libraries();
59 * Returns the path to the given JAR.
61 * Note that this may or may not be a physical path, it could be a
62 * representation of the JAR file in string form.
64 * @param __jar The JAR to get the path of.
65 * @return The path of the given JAR.
66 * @throws MLECallError If the JAR is not valid.
70 public static native String
libraryPath(JarPackageBracket __jar
)
74 * Opens the resource from the input stream.
76 * @param __jar The JAR to open.
77 * @param __rc The resource to load from the given JAR.
78 * @return Input stream to the resource, may be {@code null} if it does
80 * @throws MLECallError If the JAR is not valid or the resource was not
85 public static native InputStream
openResource(JarPackageBracket __jar
,
90 * Reads a section of a JAR representation, note that the format is not
91 * necessarily in the format of a JAR or ZIP file but may exist in SQC
94 * @param __jar The library to read the raw data from.
95 * @param __jarOffset The offset into the raw data.
96 * @param __b The buffer to write into.
97 * @param __o The offset into the buffer.
98 * @param __l The length of the buffer.
99 * @return The number of bytes read from the raw Jar data.
100 * @throws MLECallError On null arguments or if the offset and/or length
101 * exceed the array bounds.
105 public static native int rawData(JarPackageBracket __jar
,
106 int __jarOffset
, byte[] __b
, int __o
, int __l
)
110 * Returns the raw size of a given JAR, note that this may not be
111 * the size of a JAR file but a compiled form such a SQC.
113 * @param __jar The JAR to lookup.
114 * @return The raw size of the JAR, this will be a negative value if the
115 * JAR is virtual and its size is not known.
116 * @throws MLECallError If {@code __jar} is null.
120 public static native int rawSize(JarPackageBracket __jar
)