File tree Expand file tree Collapse file tree
src/main/java/com/fasterxml/jackson/core/util Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -57,18 +57,26 @@ public enum CharBufferType {
5757
5858 public BufferRecycler () { }
5959
60- public final byte [] allocByteBuffer (ByteBufferType type )
60+ public final byte [] allocByteBuffer (ByteBufferType type ) {
61+ return allocByteBuffer (type , 0 );
62+ }
63+
64+ public final byte [] allocByteBuffer (ByteBufferType type , int minSize )
6165 {
62- int ix = type .ordinal ();
66+ final int ix = type .ordinal ();
67+ final int DEF_SIZE = type .size ;
68+ if (minSize < DEF_SIZE ) {
69+ minSize = DEF_SIZE ;
70+ }
6371 byte [] buffer = _byteBuffers [ix ];
64- if (buffer == null ) {
65- buffer = balloc (type . size );
72+ if (buffer == null || buffer . length < minSize ) {
73+ buffer = balloc (minSize );
6674 } else {
6775 _byteBuffers [ix ] = null ;
6876 }
6977 return buffer ;
7078 }
71-
79+
7280 public final void releaseByteBuffer (ByteBufferType type , byte [] buffer )
7381 {
7482 _byteBuffers [type .ordinal ()] = buffer ;
You can’t perform that action at this time.
0 commit comments