Package co.elastic.clients.util
Class NoCopyByteArrayOutputStream
java.lang.Object
java.io.OutputStream
java.io.ByteArrayOutputStream
co.elastic.clients.util.NoCopyByteArrayOutputStream
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
A
ByteArrayOutputStream
that reduces copy operations of its underlying buffer.-
Field Summary
Fields inherited from class java.io.ByteArrayOutputStream
buf, count
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbyte[]
array()
Get the underlying buffer.Get aByteBuffer
view on this object, based on the current buffer and size.Get anInputStream
view on this object, based on the current buffer and size.Methods inherited from class java.io.ByteArrayOutputStream
close, reset, size, toByteArray, toString, toString, toString, toString, write, write, writeBytes, writeTo
Methods inherited from class java.io.OutputStream
flush, nullOutputStream, write
-
Constructor Details
-
NoCopyByteArrayOutputStream
public NoCopyByteArrayOutputStream() -
NoCopyByteArrayOutputStream
public NoCopyByteArrayOutputStream(int size)
-
-
Method Details
-
array
public byte[] array()Get the underlying buffer. Data was added to this buffer up tosize()
. Note that calling this method again may return a different result if additional data was inserted and the buffer had to grow. -
asInputStream
Get anInputStream
view on this object, based on the current buffer and size. -
asByteBuffer
Get aByteBuffer
view on this object, based on the current buffer and size.
-