Make it so mapping files are used and then reapplied.
[SquirrelJME.git] / modules / cldc-compact / src / main / java / cc / squirreljme / jvm / mle / JarPackageShelf.java
blob1508272d8205806cf81abe2429490877d9d0b758
1 // -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
2 // ---------------------------------------------------------------------------
3 // SquirrelJME
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;
18 /**
19 * This allows access to the library class path and resources.
21 * @since 2020/06/07
23 @Api
24 public final class JarPackageShelf
26 /**
27 * Returns the classpath of the current program.
29 * @return The classpath of the current program.
30 * @since 2020/06/07
32 @Api
33 public static native JarPackageBracket[] classPath();
35 /**
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}.
42 * @since 2020/07/02
44 @Api
45 public static native boolean equals(
46 JarPackageBracket __a, JarPackageBracket __b)
47 throws MLECallError;
49 /**
50 * Returns the libraries which are available to the virtual machine.
52 * @return The libraries that are currently available.
53 * @since 2020/10/31
55 @Api
56 public static native JarPackageBracket[] libraries();
58 /**
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.
67 * @since 2020/10/31
69 @Api
70 public static native String libraryPath(JarPackageBracket __jar)
71 throws MLECallError;
73 /**
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
79 * not exist.
80 * @throws MLECallError If the JAR is not valid or the resource was not
81 * specified.
82 * @since 2020/06/07
84 @Api
85 public static native InputStream openResource(JarPackageBracket __jar,
86 String __rc)
87 throws MLECallError;
89 /**
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
92 * form.
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.
102 * @since 2022/03/04
104 @Api
105 public static native int rawData(JarPackageBracket __jar,
106 int __jarOffset, byte[] __b, int __o, int __l)
107 throws MLECallError;
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.
117 * @since 2022/03/04
119 @Api
120 public static native int rawSize(JarPackageBracket __jar)
121 throws MLECallError;