Add vendor API to software math.
[SquirrelJME.git] / modules / cldc-compact / src / main / java / cc / squirreljme / jvm / mle / JarPackageShelf.java
blob61a7631172fbe642a89570541464960dd10bf307
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 java.io.InputStream;
17 /**
18 * This allows access to the library class path and resources.
20 * @since 2020/06/07
22 @SquirrelJMEVendorApi
23 public final class JarPackageShelf
25 /**
26 * Returns the classpath of the current program.
28 * @return The classpath of the current program.
29 * @since 2020/06/07
31 @SquirrelJMEVendorApi
32 public static native JarPackageBracket[] classPath();
34 /**
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}.
41 * @since 2020/07/02
43 @SquirrelJMEVendorApi
44 public static native boolean equals(
45 JarPackageBracket __a, JarPackageBracket __b)
46 throws MLECallError;
48 /**
49 * Returns the libraries which are available to the virtual machine.
51 * @return The libraries that are currently available.
52 * @since 2020/10/31
54 @SquirrelJMEVendorApi
55 public static native JarPackageBracket[] libraries();
57 /**
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.
66 * @since 2020/10/31
68 @SquirrelJMEVendorApi
69 public static native String libraryPath(JarPackageBracket __jar)
70 throws MLECallError;
72 /**
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
78 * not exist.
79 * @throws MLECallError If the JAR is not valid or the resource was not
80 * specified.
81 * @since 2020/06/07
83 @SquirrelJMEVendorApi
84 public static native InputStream openResource(JarPackageBracket __jar,
85 String __rc)
86 throws MLECallError;
88 /**
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
91 * form.
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.
101 * @since 2022/03/04
103 @SquirrelJMEVendorApi
104 public static native int rawData(JarPackageBracket __jar,
105 int __jarOffset, byte[] __b, int __o, int __l)
106 throws MLECallError;
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.
116 * @since 2022/03/04
118 @SquirrelJMEVendorApi
119 public static native int rawSize(JarPackageBracket __jar)
120 throws MLECallError;