Skip to content

Commit

Permalink
Quarkus REST - Use ByteBufInputStream instead of copying bytes
Browse files Browse the repository at this point in the history
This is related to #45122 and reduce the amount of copy of the content
we keep in memory.

(cherry picked from commit 09edb56)
  • Loading branch information
gsmet committed Jan 14, 2025
1 parent 65d670a commit 3b8197c
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.jboss.resteasy.reactive.client.handlers;

import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
Expand Down Expand Up @@ -41,6 +40,7 @@
import org.jboss.resteasy.reactive.common.core.Serialisers;
import org.jboss.resteasy.reactive.common.util.MultivaluedTreeMap;

import io.netty.buffer.ByteBufInputStream;
import io.netty.handler.codec.DecoderException;
import io.netty.handler.codec.http.HttpHeaderValues;
import io.netty.handler.codec.http.LastHttpContent;
Expand Down Expand Up @@ -361,7 +361,7 @@ public void handle(AsyncResult<Buffer> ar) {
try {
if (buffer.length() > 0) {
requestContext.setResponseEntityStream(
new ByteArrayInputStream(buffer.getBytes()));
new ByteBufInputStream(buffer.getByteBuf()));
} else {
requestContext.setResponseEntityStream(null);
}
Expand Down

0 comments on commit 3b8197c

Please sign in to comment.