Package herddb.utils
Class VisibleByteArrayOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- herddb.utils.VisibleByteArrayOutputStream
-
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
public class VisibleByteArrayOutputStream extends OutputStream
Simple ByteArrayOutputStream which exposes the internal array- Author:
- enrico.olivelli
-
-
Constructor Summary
Constructors Constructor Description VisibleByteArrayOutputStream()VisibleByteArrayOutputStream(int size)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()byte[]getBuffer()voidreset()intsize()byte[]toByteArray()byte[]toByteArrayNoCopy()Return the internal buffer or perform a copyByteBuffertoByteBuffer()StringtoString(Charset charset)voidwrite(byte[] b)voidwrite(byte[] b, int off, int len)voidwrite(int b)voidwriteTo(OutputStream out)byte[]xxhash64()-
Methods inherited from class java.io.OutputStream
flush, nullOutputStream
-
-
-
-
Method Detail
-
write
public void write(int b)
- Specified by:
writein classOutputStream
-
write
public void write(byte[] b, int off, int len)- Overrides:
writein classOutputStream
-
write
public void write(byte[] b)
- Overrides:
writein classOutputStream
-
writeTo
public void writeTo(OutputStream out) throws IOException
- Throws:
IOException
-
reset
public void reset()
-
xxhash64
public byte[] xxhash64()
-
toByteArray
public byte[] toByteArray()
-
toByteArrayNoCopy
public byte[] toByteArrayNoCopy()
Return the internal buffer or perform a copy- Returns:
- the internal buffer or a copy
-
size
public int size()
-
getBuffer
public byte[] getBuffer()
-
toByteBuffer
public ByteBuffer toByteBuffer()
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream
-
-