Jar
Wrapper around a Java Archive file.
Provides convenience methods for loading a Jar's classes.
Static Method Summary
Static Public Methods | ||
public static |
Static constructor for a Jar that also attempts to load all classes contained in the Jar file. |
Constructor Summary
Public Constructor | ||
public |
constructor(file: string) You probably want to create a new instance using Jar.unpack |
Member Summary
Public Members | ||
public get |
classBuffers: Map<string, Buffer>: * |
|
public get |
|
Private Members | ||
private |
|
|
private |
_classes: * |
|
private |
_file: * |
Method Summary
Public Methods | ||
public |
[Symbol.iterator](): Iterator ClassCollection iterator |
Private Methods | ||
private |
loadBuffers(): Promise<Jar> |
Static Public Methods
public static unpack(file: string): Promise<Jar> source
Static constructor for a Jar that also attempts to load all classes contained in the Jar file.
Creates a new ClassLoader under the hood to load the classes.
Params:
Name | Type | Attribute | Description |
file | string | path to Jar file |
Example:
// ES6 example
import { Jar } from 'jvm';
Jar.unpack('./test.jar')
.then((jar) => {
for (let [name, cls] of jar) {
if (name === 'ClassNameToFind') {
console.log(name, 'has', cls.methods.length, 'methods!');
}
}
});
Public Constructors
public constructor(file: string) source
You probably want to create a new instance using Jar.unpack
Params:
Name | Type | Attribute | Description |
file | string | path to Jar file |