Skip to content

Commit fb1850b

Browse files
authored
Reduce buffer size for ASCII string optimization to 63 bytes (#3279)
1 parent b61427f commit fb1850b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lang/java/avro/src/main/java/org/apache/avro/io/BinaryEncoder.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,12 @@
3737
*/
3838
public abstract class BinaryEncoder extends Encoder {
3939

40-
// Buffer used for writing ASCII strings
41-
private final byte[] stringBuffer = new byte[128];
40+
/*
41+
* Buffer used for writing ASCII strings. A string is encoded as a long followed
42+
* by that many bytes of character data. A string of length 63 is the upper
43+
* limit for a 1 byte variable-length long value.
44+
*/
45+
private final byte[] stringBuffer = new byte[63];
4246

4347
@Override
4448
public void writeNull() throws IOException {

0 commit comments

Comments
 (0)