-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reduce allocation cost reporting spans
This is done by leveraging Vert.x's Buffer directly instead of relying on a ByteArrayOutputStream
- Loading branch information
Showing
4 changed files
with
37 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
extensions/vertx/runtime/src/main/java/io/quarkus/vertx/core/runtime/BufferOutputStream.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package io.quarkus.vertx.core.runtime; | ||
|
||
import java.io.IOException; | ||
import java.io.OutputStream; | ||
|
||
import io.vertx.core.buffer.Buffer; | ||
|
||
/** | ||
* Simple {@link OutputStream} implementation that appends content | ||
* written in given {@link Buffer} instance. | ||
*/ | ||
public class BufferOutputStream extends OutputStream { | ||
|
||
private final Buffer buffer; | ||
|
||
public BufferOutputStream(Buffer buffer) { | ||
this.buffer = buffer; | ||
} | ||
|
||
@Override | ||
public void write(byte[] b, int off, int len) throws IOException { | ||
buffer.appendBytes(b, off, len); | ||
} | ||
|
||
@Override | ||
public void write(int b) throws IOException { | ||
buffer.appendInt(b); | ||
} | ||
} |