Class WasmTarget

java.lang.Object
de.inetsoftware.jwebassembly.module.WasmTarget
All Implemented Interfaces:
Closeable, AutoCloseable

public class WasmTarget extends Object implements Closeable
The target for the different outputs
  • Field Details

  • Constructor Details

    • WasmTarget

      public WasmTarget(File file)
      Create a target with a file.
      Parameters:
      file - the wasm file
    • WasmTarget

      public WasmTarget(OutputStream output)
      Create a target with an OutputStream
      Parameters:
      output - the stream for the wasm file
    • WasmTarget

      public WasmTarget(Appendable output)
      Create a target with an Appendable for text export
      Parameters:
      output - the stream for the wasm file
  • Method Details

    • getWasmOutput

      @Nonnull public OutputStream getWasmOutput() throws IOException
      Get the wasm OutputStream
      Returns:
      the stream
      Throws:
      IOException - if any I/O error occur
    • getTextOutput

      public Appendable getTextOutput() throws IOException
      Get the output for the text format.
      Returns:
      the target
      Throws:
      IOException - if any I/O error occur
    • getSourceMappingURL

      @Nonnull public 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 Writer getSourceMapOutput() throws IOException
      Get the source map OutputStream
      Returns:
      the stream
      Throws:
      IOException - if any I/O error occur
    • getJavaScriptOutput

      public Writer getJavaScriptOutput() throws IOException
      Get the output for the JavaScript glue code.
      Returns:
      the script output.
      Throws:
      IOException - if any I/O error occur
    • getBaseWasmFile

      private String getBaseWasmFile()
      Get the base name without extension.
      Returns:
      the base file name
    • close

      public void close() throws IOException
      Close all streams
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException - if any I/O error occur