@@ -88,34 +88,34 @@ public Pipeline(byte[] wasmBytes) {
88
88
}
89
89
90
90
public List <PipelineOutput <?>> run (List <String > args , List <PipelineOutput <?>> outputs , List <PipelineInput <?>> inputs ) {
91
- try (RunInstance ri = new RunInstance (args , outputs , inputs )) {
92
- int returnCode = ri .delayedStart ();
93
-
94
- List <PipelineOutput <?>> populatedOutputs = new ArrayList <>();
95
- if (!outputs .isEmpty () && returnCode == 0 ) {
96
- for (int index = 0 ; index < outputs .size (); index ++) {
97
- PipelineOutput <?> output = outputs .get (index );
98
- if (output .type == InterfaceTypes .TextStream ) {
99
- int dataPtr = ri .outputArrayAddress (0 , index , 0 );
100
- int dataLen = ri .outputArraySize (0 , index , 0 );
101
- byte [] dataBytes = ri .wasmTimeLift (dataPtr , dataLen );
102
- String dataString = str (dataBytes );
103
- TextStream textStream = new TextStream (dataString );
104
- populatedOutputs .add (new PipelineOutput <>(InterfaceTypes .TextStream , textStream ));
105
- } else if (output .type == InterfaceTypes .BinaryStream ) {
106
- int dataPtr = ri .outputArrayAddress (0 , index , 0 );
107
- int dataLen = ri .outputArraySize (0 , index , 0 );
108
- byte [] dataBytes = ri .wasmTimeLift (dataPtr , dataLen );
109
- BinaryStream binaryStream = new BinaryStream (dataBytes );
110
- populatedOutputs .add (new PipelineOutput <>(InterfaceTypes .BinaryStream , binaryStream ));
111
- } else {
112
- throw new IllegalArgumentException ("Unexpected/not yet supported output.type " + output .type );
113
- }
114
- }
115
- }
116
-
117
- return populatedOutputs ;
118
- }
91
+ try (RunInstance ri = new RunInstance (args , outputs , inputs )) {
92
+ int returnCode = ri .delayedStart ();
93
+
94
+ List <PipelineOutput <?>> populatedOutputs = new ArrayList <>();
95
+ if (!outputs .isEmpty () && returnCode == 0 ) {
96
+ for (int index = 0 ; index < outputs .size (); index ++) {
97
+ PipelineOutput <?> output = outputs .get (index );
98
+ if (output .type == InterfaceTypes .TextStream ) {
99
+ int dataPtr = ri .outputArrayAddress (0 , index , 0 );
100
+ int dataLen = ri .outputArraySize (0 , index , 0 );
101
+ byte [] dataBytes = ri .wasmTimeLift (dataPtr , dataLen );
102
+ String dataString = str (dataBytes );
103
+ TextStream textStream = new TextStream (dataString );
104
+ populatedOutputs .add (new PipelineOutput <>(InterfaceTypes .TextStream , textStream ));
105
+ } else if (output .type == InterfaceTypes .BinaryStream ) {
106
+ int dataPtr = ri .outputArrayAddress (0 , index , 0 );
107
+ int dataLen = ri .outputArraySize (0 , index , 0 );
108
+ byte [] dataBytes = ri .wasmTimeLift (dataPtr , dataLen );
109
+ BinaryStream binaryStream = new BinaryStream (dataBytes );
110
+ populatedOutputs .add (new PipelineOutput <>(InterfaceTypes .BinaryStream , binaryStream ));
111
+ } else {
112
+ throw new IllegalArgumentException ("Unexpected/not yet supported output.type " + output .type );
113
+ }
114
+ }
115
+ }
116
+
117
+ return populatedOutputs ;
118
+ }
119
119
}
120
120
121
121
private static String purePosixPath (Path p ) {
@@ -252,10 +252,10 @@ public RunInstance(List<String> args, List<PipelineOutput<?>> outputs,
252
252
public void freeAll () { freeAll .accept (); }
253
253
254
254
public ByteBuffer memoryBuffer (int offset , int length ) {
255
- ByteBuffer buffer = memory .buffer (store );
256
- buffer .position (offset );
257
- buffer .limit (length );
258
- return buffer .slice ();
255
+ ByteBuffer buffer = memory .buffer (store );
256
+ buffer .position (offset );
257
+ buffer .limit (length );
258
+ return buffer .slice ();
259
259
}
260
260
public int memorySize () { return memory .size (store ); }
261
261
0 commit comments