Package webwork.util
Class FastByteArrayOutputStream
java.lang.Object
java.io.OutputStream
webwork.util.FastByteArrayOutputStream
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
A speedy implementation of ByteArrayOutputStream. It's not synchronized, and it does not copy buffers when it's
expanded. There's also no copying of the internal buffer if it's contents is extracted with the writeTo(stream)
method.
- Version:
- $Revision: 1.5 $
- Author:
- Rickard Öberg
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidCreate a new buffer and store the current one in linked listvoidclose()intgetSize()byte[]toString()voidwrite(byte[] data, int offset, int length) voidwrite(int datum) voidvoidwriteTo(OutputStream out) voidwriteTo(RandomAccessFile out) Methods inherited from class java.io.OutputStream
flush, nullOutputStream, write
-
Constructor Details
-
FastByteArrayOutputStream
public FastByteArrayOutputStream() -
FastByteArrayOutputStream
public FastByteArrayOutputStream(int aSize)
-
-
Method Details
-
writeTo
- Throws:
IOException
-
writeTo
- Throws:
IOException
-
writeTo
- Throws:
IOException
-
getSize
public int getSize() -
toByteArray
public byte[] toByteArray() -
toString
-
addBuffer
protected void addBuffer()Create a new buffer and store the current one in linked list -
write
- Specified by:
writein classOutputStream- Throws:
IOException
-
write
- Overrides:
writein classOutputStream- Throws:
IOException
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream
-