File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
frameworks/Java/helidon/nima/src/main/java/io/helidon/benchmark/nima/services Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change 8
8
import com .fizzed .rocker .runtime .ArrayOfByteArraysOutput ;
9
9
import io .helidon .benchmark .nima .models .DbRepository ;
10
10
import io .helidon .benchmark .nima .models .Fortune ;
11
- import io .helidon .common .buffers .BufferData ;
12
11
import io .helidon .webserver .http .Handler ;
13
12
import io .helidon .webserver .http .ServerRequest ;
14
13
import io .helidon .webserver .http .ServerResponse ;
@@ -39,11 +38,17 @@ public void handle(ServerRequest req, ServerResponse res) {
39
38
Collections .sort (fortuneList );
40
39
ArrayOfByteArraysOutput output = fortunes .template (fortuneList ).render (ArrayOfByteArraysOutput .FACTORY );
41
40
List <byte []> entity = output .getArrays ();
42
- BufferData bufferData = BufferData .create (entity .stream ().map (BufferData ::create ).toList ());
43
- int length = bufferData .available ();
41
+
42
+ int length = 0 ;
43
+ for (byte [] bytes : entity ) {
44
+ length += bytes .length ;
45
+ }
44
46
res .header (CONTENT_LENGTH , String .valueOf (length ));
47
+
45
48
try (var out = res .outputStream ()) {
46
- bufferData .writeTo (out );
49
+ for (byte [] bytes : entity ) {
50
+ out .write (bytes );
51
+ }
47
52
} catch (IOException e ) {
48
53
throw new RuntimeException (e );
49
54
}
You can’t perform that action at this time.
0 commit comments