Package io.datarouter.bytes
Class ExposedByteArrayOutputStream
java.lang.Object
java.io.OutputStream
java.io.ByteArrayOutputStream
io.datarouter.bytes.ExposedByteArrayOutputStream
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
For converting from a ByteArrayOutputStream to a ByteArrayInputStream without making a copy of the data.
Should be used carefully for performance-critical situations.
Expected behavior:
- populate the OutputStream
- convert to InputStream using toInputStream()
- drain the InputStream
- optionally repeat by calling reset() on the OutputStream to avoid allocating
-
Field Summary
Fields inherited from class java.io.ByteArrayOutputStream
buf, count -
Constructor Summary
Constructors -
Method Summary
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
-
ExposedByteArrayOutputStream
public ExposedByteArrayOutputStream() -
ExposedByteArrayOutputStream
public ExposedByteArrayOutputStream(int initialCapacity)
-
-
Method Details
-
toInputStream
-