public class ByteBufferOutputStream2
extends java.io.OutputStream
ByteBufferPool
or freshly allocated if one is not supplied.
Designed to mimic ByteArrayOutputStream
but with better memory usage, and less copying.Constructor and Description |
---|
ByteBufferOutputStream2() |
ByteBufferOutputStream2(ByteBufferPool bufferPool,
boolean direct) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
ByteBufferPool |
getByteBufferPool() |
int |
size() |
java.nio.ByteBuffer |
takeByteBuffer()
Take the combined buffer containing all content written to the OutputStream.
|
byte[] |
toByteArray() |
java.nio.ByteBuffer |
toByteBuffer()
Take the combined buffer containing all content written to the OutputStream.
|
java.lang.String |
toString() |
void |
write(byte[] b,
int off,
int len) |
void |
write(java.nio.ByteBuffer buffer) |
void |
write(int b) |
void |
writeTo(java.nio.ByteBuffer buffer) |
void |
writeTo(java.io.OutputStream out) |
public ByteBufferOutputStream2()
public ByteBufferOutputStream2(ByteBufferPool bufferPool, boolean direct)
public ByteBufferPool getByteBufferPool()
public java.nio.ByteBuffer takeByteBuffer()
ByteBuffer
back into the ByteBufferPool
.public java.nio.ByteBuffer toByteBuffer()
ByteBufferPool
when the OutputStream is closed.public byte[] toByteArray()
public int size()
public void write(int b)
write
in class java.io.OutputStream
public void write(byte[] b, int off, int len)
write
in class java.io.OutputStream
public void write(java.nio.ByteBuffer buffer)
public void writeTo(java.nio.ByteBuffer buffer)
public void writeTo(java.io.OutputStream out) throws java.io.IOException
java.io.IOException
public void close()
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.OutputStream
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 1995–2021 Webtide. All rights reserved.