File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
src/de/inetsoftware/jwebassembly Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 21
21
import java .io .FileOutputStream ;
22
22
import java .io .IOException ;
23
23
import java .io .OutputStream ;
24
+ import java .io .OutputStreamWriter ;
24
25
import java .net .MalformedURLException ;
25
26
import java .net .URL ;
27
+ import java .nio .charset .StandardCharsets ;
26
28
import java .util .ArrayList ;
27
29
import java .util .HashMap ;
28
30
import java .util .List ;
@@ -112,6 +114,22 @@ public String compileToText() throws WasmException {
112
114
return output .toString ();
113
115
}
114
116
117
+ /**
118
+ * Convert the added files to a WebAssembly module in text representation.
119
+ *
120
+ * @param file
121
+ * the target for the module data
122
+ * @throws WasmException
123
+ * if any conversion error occurs
124
+ */
125
+ public void compileToText ( File file ) throws WasmException {
126
+ try (TextModuleWriter writer = new TextModuleWriter ( new OutputStreamWriter ( new FileOutputStream ( file ), StandardCharsets .UTF_8 ) )) {
127
+ compile ( writer );
128
+ } catch ( Exception ex ) {
129
+ throw WasmException .create ( ex );
130
+ }
131
+ }
132
+
115
133
/**
116
134
* Convert the added files to a WebAssembly module in text representation.
117
135
*
You can’t perform that action at this time.
0 commit comments