public class LimitedByteArrayOutputStream extends OutputStream
EncodingLimitsExceededIoException if more is tried to be written.| Modifier and Type | Method and Description |
|---|---|
void |
reset()
Behaves same as
ByteArrayOutputStream.reset(). |
byte[] |
toByteArray()
Behaves same as
ByteArrayOutputStream.toByteArray(). |
String |
toString() |
static LimitedByteArrayOutputStream |
withSizeLimit(int maxBytes)
Creates a new limited
ByteArrayOutputStream with the given limit and default capasity
of ByteArrayOutputStream. |
void |
write(byte[] bytes) |
void |
write(byte[] bytes,
int off,
int len) |
void |
write(int b)
Behaves same as
ByteArrayOutputStream.write(int), but if the size of the underlying
stream is at limit, will throw EncodingLimitsExceededIoException instead |
close, flushpublic static LimitedByteArrayOutputStream withSizeLimit(int maxBytes)
ByteArrayOutputStream with the given limit and default capasity
of ByteArrayOutputStream.maxBytes - maximum number of bytes that can be written to the stream before it throwspublic void reset()
ByteArrayOutputStream.reset().public byte[] toByteArray()
ByteArrayOutputStream.toByteArray().public void write(byte[] bytes)
throws EncodingLimitsExceededIoException
write in class OutputStreamEncodingLimitsExceededIoExceptionpublic void write(byte[] bytes,
int off,
int len)
throws EncodingLimitsExceededIoException
write in class OutputStreamEncodingLimitsExceededIoExceptionpublic void write(int b)
throws EncodingLimitsExceededIoException
ByteArrayOutputStream.write(int), but if the size of the underlying
stream is at limit, will throw EncodingLimitsExceededIoException insteadwrite in class OutputStreamEncodingLimitsExceededIoExceptionCopyright © 2026. All rights reserved.