Package com.itextpdf.io.source
Class ByteArrayOutputStream
java.lang.Object
java.io.OutputStream
java.io.ByteArrayOutputStream
com.itextpdf.io.source.ByteArrayOutputStream
- All Implemented Interfaces:
-
Closeable,Flushable,AutoCloseable
A byte-array output stream whose backing array can be assigned directly.
-
Field Summary
Fields inherited from class java.io.ByteArrayOutputStream
buf, count -
Constructor Summary
ConstructorsConstructorDescriptionCreates an empty stream with the default initial capacity.ByteArrayOutputStream(int size) Creates an empty stream with the specified initial capacity. -
Method Summary
Modifier and TypeMethodDescriptionassignBytes(byte[] bytes) Replaces this stream's backing array and marks all of it as written.assignBytes(byte[] bytes, int count) Replaces this stream's backing array and logical byte count.Methods inherited from class java.io.ByteArrayOutputStream
close, reset, size, toByteArray, toString, toString, toString, toString, write, write, writeBytes, writeToMethods inherited from class java.io.OutputStream
flush, nullOutputStream, write
-
Constructor Details
-
ByteArrayOutputStream
public ByteArrayOutputStream()Creates an empty stream with the default initial capacity. -
ByteArrayOutputStream
public ByteArrayOutputStream(int size) Creates an empty stream with the specified initial capacity.- Parameters:
-
size- the initial backing-array size
-
-
Method Details
-
assignBytes
Replaces this stream's backing array and logical byte count.- Parameters:
-
bytes- the replacement backing array, retained without copying -
count- the number of bytes inbytesconsidered written - Returns:
- this stream
-
assignBytes
Replaces this stream's backing array and marks all of it as written.- Parameters:
-
bytes- the replacement backing array, retained without copying - Returns:
- this stream
-