Class WasmTarget
- java.lang.Object
-
- de.inetsoftware.jwebassembly.module.WasmTarget
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
public class WasmTarget extends java.lang.Object implements java.io.CloseableThe target for the different outputs
-
-
Field Summary
Fields Modifier and Type Field Description private java.io.Filefileprivate java.io.WriterjavaScriptprivate java.io.OutputStreamoutputprivate java.io.WritersourceMapprivate java.lang.AppendabletextOutput
-
Constructor Summary
Constructors Constructor Description WasmTarget(java.io.File file)Create a target with a file.WasmTarget(java.io.OutputStream output)Create a target with an OutputStreamWasmTarget(java.lang.Appendable output)Create a target with an Appendable for text export
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Close all streamsprivate java.lang.StringgetBaseWasmFile()Get the base name without extension.java.io.WritergetJavaScriptOutput()Get the output for the JavaScript glue code.java.io.WritergetSourceMapOutput()Get the source map OutputStreamjava.lang.StringgetSourceMappingURL()Get the URL for the source mapping that should be write into the assembly.java.lang.AppendablegetTextOutput()Get the output for the text format.java.io.OutputStreamgetWasmOutput()Get the wasm OutputStream
-
-
-
Constructor Detail
-
WasmTarget
public WasmTarget(java.io.File file)
Create a target with a file.- Parameters:
file- the wasm file
-
WasmTarget
public WasmTarget(java.io.OutputStream output)
Create a target with an OutputStream- Parameters:
output- the stream for the wasm file
-
WasmTarget
public WasmTarget(java.lang.Appendable output)
Create a target with an Appendable for text export- Parameters:
output- the stream for the wasm file
-
-
Method Detail
-
getWasmOutput
@Nonnull public java.io.OutputStream getWasmOutput() throws java.io.IOExceptionGet the wasm OutputStream- Returns:
- the stream
- Throws:
java.io.IOException- if any I/O error occur
-
getTextOutput
public java.lang.Appendable getTextOutput() throws java.io.IOExceptionGet the output for the text format.- Returns:
- the target
- Throws:
java.io.IOException- if any I/O error occur
-
getSourceMappingURL
@Nonnull public java.lang.String getSourceMappingURL()
Get the URL for the source mapping that should be write into the assembly.- Returns:
- the URL string or null.
-
getSourceMapOutput
@Nonnull public java.io.Writer getSourceMapOutput() throws java.io.IOExceptionGet the source map OutputStream- Returns:
- the stream
- Throws:
java.io.IOException- if any I/O error occur
-
getJavaScriptOutput
public java.io.Writer getJavaScriptOutput() throws java.io.IOExceptionGet the output for the JavaScript glue code.- Returns:
- the script output.
- Throws:
java.io.IOException- if any I/O error occur
-
getBaseWasmFile
private java.lang.String getBaseWasmFile()
Get the base name without extension.- Returns:
- the base file name
-
close
public void close() throws java.io.IOExceptionClose all streams- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Throws:
java.io.IOException- if any I/O error occur
-
-