spring-framework / org.springframework.util / ResizableByteArrayOutputStream

ResizableByteArrayOutputStream

open class ResizableByteArrayOutputStream : ByteArrayOutputStream

An extension of java.io.ByteArrayOutputStream that:

As of 4.2, this class has been superseded by FastByteArrayOutputStream for Spring's internal use where no assignability to ByteArrayOutputStream is needed (since FastByteArrayOutputStream is more efficient with buffer resize management but doesn't extend the standard ByteArrayOutputStream).

Author
Brian Clozel

Author
Juergen Hoeller

Since
4.0.3

See Also
#resizeFastByteArrayOutputStream

Constructors

<init>

ResizableByteArrayOutputStream()

Create a new ResizableByteArrayOutputStream with the default initial capacity of 256 bytes.

ResizableByteArrayOutputStream(initialCapacity: Int)

Create a new ResizableByteArrayOutputStream with the specified initial capacity.

Functions

capacity

open fun capacity(): Int

Return the current size of this stream's internal buffer.

grow

open fun grow(additionalCapacity: Int): Unit

Grow the internal buffer size.

resize

open fun resize(targetCapacity: Int): Unit

Resize the internal buffer size to a specified capacity.