What is the largest adjustable byte buffer available in Java?
I need the byte buffer class in Java for single thread use When the buffer is full, the buffer should be resized instead of throwing an exception or something A very important issue for me is performance
What would you recommend
Add: I use ByteBuffer, but it cannot be resized I need one that can be resized
Solution
Don't use boring normal bytearrayoutputstream for any reason?
As Miku mentioned above, Evan Jones gives a review of different types shows that it is very suitable for applications Therefore, it is difficult to speculate without knowing further details
I will start with bytearrayoutputstream, only after the analysis shows that your performance bottleneck moves elsewhere Usually, when you believe that buffer code is a bottleneck, it will actually be network or other IO - wait until performance analysis shows that you need optimization to waste time finding a replacement
If you are moving elsewhere, you need to consider other factors:
>You have said that you are using single thread, so you don't need the synchronization of baos > what is buffer filling and entry? If either end is connected to Java NiO, it is very effective to use ByteBuffer directly Do you use circular buffers or pure linear buffers? If you then ostermiller utils is very efficient and GPL'd