Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AVRO-4052: Inline BufferedBinaryEncoder writeZero method #3145

Merged
merged 2 commits into from
Sep 15, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
* <p/>
* To change the buffer size, configure the factory instance used to create
* instances with {@link EncoderFactory#configureBufferSize(int)}
*
*
* @see Encoder
* @see EncoderFactory
* @see BlockingBinaryEncoder
Expand Down Expand Up @@ -105,7 +105,7 @@ private void flushBuffer() throws IOException {
* current position and the end. This will not expand the buffer larger than its
* current size, for writes larger than or near to the size of the buffer, we
* flush the buffer and write directly to the output, bypassing the buffer.
*
*
* @param num
* @throws IOException
*/
Expand Down Expand Up @@ -175,14 +175,11 @@ public void writeFixed(ByteBuffer bytes) throws IOException {

@Override
protected void writeZero() throws IOException {
writeByte(0);
}

private void writeByte(int b) throws IOException {
// inlined, shorter version of writeZero
if (pos == buf.length) {
flushBuffer();
}
buf[pos++] = (byte) (b & 0xFF);
buf[pos++] = (byte) (0);
belugabehr marked this conversation as resolved.
Show resolved Hide resolved
}

@Override
Expand Down
Loading