Package io.fusionauth.http.io
Class ByteBufferOutputStream
java.lang.Object
java.io.OutputStream
io.fusionauth.http.io.ByteBufferOutputStream
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
Implements an OutputStream that stores all the bytes in a growing buffer and then can return a ByteBuffer that wraps the buffer. This is
more efficient than using the toByteArray method of ByteArrayOutputStream, which makes a copy.
- Author:
- Brian Pontarelli
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.io.OutputStream
close, nullOutputStream
-
Constructor Details
-
ByteBufferOutputStream
public ByteBufferOutputStream() -
ByteBufferOutputStream
public ByteBufferOutputStream(int size, int maxCapacity)
-
-
Method Details
-
flush
public void flush()- Specified by:
flushin interfaceFlushable- Overrides:
flushin classOutputStream
-
toByteBuffer
-
write
public void write(byte[] b) - Overrides:
writein classOutputStream
-
write
public void write(byte[] b, int off, int len) - Overrides:
writein classOutputStream
-
write
public void write(int b) - Specified by:
writein classOutputStream
-