Class WasmTarget

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    public class WasmTarget
    extends java.lang.Object
    implements java.io.Closeable
    The target for the different outputs
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.io.File file  
      private java.io.Writer javaScript  
      private java.io.OutputStream output  
      private java.io.Writer sourceMap  
      private java.lang.Appendable textOutput  
    • 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 OutputStream
      WasmTarget​(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
      void close()
      Close all streams
      private java.lang.String getBaseWasmFile()
      Get the base name without extension.
      java.io.Writer getJavaScriptOutput()
      Get the output for the JavaScript glue code.
      java.io.Writer getSourceMapOutput()
      Get the source map OutputStream
      java.lang.String getSourceMappingURL()
      Get the URL for the source mapping that should be write into the assembly.
      java.lang.Appendable getTextOutput()
      Get the output for the text format.
      java.io.OutputStream getWasmOutput()
      Get the wasm OutputStream
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • file

        private java.io.File file
      • output

        private java.io.OutputStream output
      • textOutput

        private java.lang.Appendable textOutput
      • sourceMap

        private java.io.Writer sourceMap
      • javaScript

        private java.io.Writer javaScript
    • 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.IOException
        Get 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.IOException
        Get 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.IOException
        Get 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.IOException
        Get 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.IOException
        Close all streams
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException - if any I/O error occur