Skip to content

ResizableByteArrayOutputStream and ByteArrayOutputStream capacities [SPR-11594] #16218

@spring-projects-issues

Description

@spring-projects-issues

Juergen Hoeller opened SPR-11594 and commented

As part of the resolution of #12919, we introduced a ResizableByteArrayOutputStream class. For general use, this class should be designed as an actual subclass of ByteArrayOutputStream, just with a higher initial capacity and with its public grow and resize operations.

At the same time, we should revisit all our use of ByteArrayOutputStream and consistenly specify appropriate initial capacities there, analogous to our use of ResizableByteArrayOutputStream. ByteArrayOutputStream's default of 32 bytes would just lead to pointless copying when growing the internal byte array... In almost all cases, 256 or even 1024 is appropriate.


Affects: 3.2.8, 4.0.2

Issue Links:

Referenced from: commits dbd5f67, dd7f54c

Backported to: 3.2.9

Metadata

Metadata

Assignees

Labels

status: backportedAn issue that has been backported to maintenance branchestype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions