Package nl.tue.storage
Class FastByteArrayOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- nl.tue.storage.FastByteArrayOutputStream
-
- All Implemented Interfaces:
java.io.Closeable,java.io.Flushable,java.lang.AutoCloseable
- Direct Known Subclasses:
ResizeableFastByteArrayOutputStream
public class FastByteArrayOutputStream extends java.io.OutputStreamByteArrayOutputStream implementation that doesn't synchronize methods and doesn't copy the data on toByteArray(). Furthermore, no capacity changes are allowed. Once the initial capacity it set, it is assumed final!
-
-
Constructor Summary
Constructors Constructor Description FastByteArrayOutputStream()Constructs a stream with buffer capacity size 5KFastByteArrayOutputStream(int initSize)Constructs a stream with the given initial size
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]getByteArray()Returns the byte array containing the written data.intgetSize()voidreset()voidwrite(byte[] b)voidwrite(byte[] b, int off, int len)voidwrite(int b)
-
-
-
Method Detail
-
getSize
public int getSize()
-
getByteArray
public byte[] getByteArray()
Returns the byte array containing the written data. Note that this array will almost always be larger than the amount of data actually written.
-
write
public void write(byte[] b)
- Overrides:
writein classjava.io.OutputStream
-
write
public void write(byte[] b, int off, int len)- Overrides:
writein classjava.io.OutputStream
-
write
public void write(int b)
- Specified by:
writein classjava.io.OutputStream
-
reset
public void reset()
-
-