add method compileToBinary(File)

This commit is contained in:
Volker Berlin 2017-04-02 10:04:23 +02:00
parent 7add526da1
commit 7d0f42c225

View File

@ -19,6 +19,7 @@ import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.util.ArrayList; import java.util.ArrayList;
@ -98,6 +99,22 @@ public class JWebAssembly {
return output.toByteArray(); return output.toByteArray();
} }
/**
* Convert the added files to a WebAssembly module in binary representation.
*
* @param file
* the target for the module data
* @throws WasmException
* if any conversion error occurs
*/
public void compileToBinary( File file ) throws WasmException {
try (FileOutputStream output = new FileOutputStream( file )) {
compileToBinary( output );
} catch( Exception ex ) {
throw WasmException.create( ex );
}
}
/** /**
* Convert the added files to a WebAssembly module in binary representation. * Convert the added files to a WebAssembly module in binary representation.
* *