Package io.polywrap.wasm
Class WasmPackage
-
- All Implemented Interfaces:
public final class WasmPackage implements WrapPackage, AutoCloseable
Implementation of the WrapPackage interface for Wasm Wrap packages
-
-
Field Summary
Fields Modifier and Type Field Description private final <Error class: unknown class>ffiWrapPackage
-
Constructor Summary
Constructors Constructor Description WasmPackage(ByteArray manifestBuffer, ByteArray wasmModule, FileReader fileReader)Creates a new WasmPackage instance with the given manifest buffer and wasm module buffer. WasmPackage(ByteArray manifestBuffer, FileReader fileReader)Creates a new WasmPackage instance with the given manifest buffer and file reader. WasmPackage(FileReader fileReader, ByteArray wasmModule)Creates a new WasmPackage instance with the given wasm module and file reader. WasmPackage(FileReader fileReader)
-
Method Summary
Modifier and Type Method Description final <Error class: unknown class>getFfiWrapPackage()Result<WrapManifest01>getManifest()Produce an instance of the WrapPackage's WRAP manifest WrappercreateWrapper()Construct an instance of the package's Wasm Wrapper Result<ByteArray>getFile(String path)Retrieves the file at the specified path within the Wrap package. final Result<ByteArray>getWasmModule()Reads the Wasm module from the Wrap package using the provided FileReader, and returns the module bytes Unitclose()-
-
Constructor Detail
-
WasmPackage
WasmPackage(ByteArray manifestBuffer, ByteArray wasmModule, FileReader fileReader)
Creates a new WasmPackage instance with the given manifest buffer and wasm module buffer.- Parameters:
manifestBuffer- the manifest bufferwasmModule- the wasm module bufferfileReader- a file reader used to read other package files
-
WasmPackage
WasmPackage(ByteArray manifestBuffer, FileReader fileReader)
Creates a new WasmPackage instance with the given manifest buffer and file reader.- Parameters:
manifestBuffer- the manifest bufferfileReader- a file reader used to read other package files
-
WasmPackage
WasmPackage(FileReader fileReader, ByteArray wasmModule)
Creates a new WasmPackage instance with the given wasm module and file reader.- Parameters:
fileReader- a file reader used to read other package fileswasmModule- the wasm module buffer
-
WasmPackage
WasmPackage(FileReader fileReader)
- Parameters:
fileReader- A FileReader instance used to read the package files, including the Wasm module and WRAP manifest
-
-
Method Detail
-
getFfiWrapPackage
final <Error class: unknown class> getFfiWrapPackage()
-
getManifest
Result<WrapManifest01> getManifest()
Produce an instance of the WrapPackage's WRAP manifest
-
createWrapper
Wrapper createWrapper()
Construct an instance of the package's Wasm Wrapper
-
getFile
Result<ByteArray> getFile(String path)
Retrieves the file at the specified path within the Wrap package.
- Parameters:
path- The path to the file.
-
getWasmModule
final Result<ByteArray> getWasmModule()
Reads the Wasm module from the Wrap package using the provided FileReader, and returns the module bytes
-
-
-
-