Class FastByteArrayOutputStream
java.lang.Object
java.io.OutputStream
java.io.ByteArrayOutputStream
com.opensymphony.module.sitemesh.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.2 $
- Author:
- Rickard �berg, Scott Farquhar
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate int
private byte[]
Internal buffer.private LinkedList
private static final int
private int
private int
Fields inherited from class java.io.ByteArrayOutputStream
buf, count
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.io.ByteArrayOutputStream
toString, toString, writeBytes
Methods inherited from class java.io.OutputStream
nullOutputStream, write
-
Field Details
-
DEFAULT_BLOCK_SIZE
private static final int DEFAULT_BLOCK_SIZE- See Also:
-
buffer
private byte[] bufferInternal buffer. -
buffers
-
index
private int index -
size
private int size -
blockSize
private int blockSize
-
-
Constructor Details
-
FastByteArrayOutputStream
public FastByteArrayOutputStream() -
FastByteArrayOutputStream
public FastByteArrayOutputStream(int aSize)
-
-
Method Details
-
writeTo
- Overrides:
writeTo
in classByteArrayOutputStream
- Throws:
IOException
-
size
public int size()- Overrides:
size
in classByteArrayOutputStream
-
toByteArray
public byte[] toByteArray()- Overrides:
toByteArray
in classByteArrayOutputStream
-
write
public void write(int datum) - Overrides:
write
in classByteArrayOutputStream
-
write
public void write(byte[] data, int offset, int length) - Overrides:
write
in classByteArrayOutputStream
-
reset
public void reset()- Overrides:
reset
in classByteArrayOutputStream
-
toString
- Overrides:
toString
in classByteArrayOutputStream
- Throws:
UnsupportedEncodingException
-
toString
- Overrides:
toString
in classByteArrayOutputStream
-
flush
- Specified by:
flush
in interfaceFlushable
- Overrides:
flush
in classOutputStream
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classByteArrayOutputStream
- Throws:
IOException
-