Package org.apache.struts2.util
Class FastByteArrayOutputStream
java.lang.Object
java.io.OutputStream
org.apache.struts2.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.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidvoidclose()intgetSize()byte[]toString()voidwrite(byte[] data, int offset, int length) voidwrite(int datum) voidThis is a patched method (standard)voidwriteTo(OutputStream out) voidwriteTo(RandomAccessFile out) voidThis is a patched method (added for common Writer, needed for tests)Methods inherited from class java.io.OutputStream
flush, nullOutputStream, write
-
Constructor Details
-
FastByteArrayOutputStream
public FastByteArrayOutputStream() -
FastByteArrayOutputStream
public FastByteArrayOutputStream(int blockSize)
-
-
Method Details
-
writeTo
- Throws:
IOException
-
writeTo
- Throws:
IOException
-
writeTo
This is a patched method (added for common Writer, needed for tests)- Parameters:
out- Writerencoding- Encoding- Throws:
IOException- If some output failed
-
writeTo
This is a patched method (standard)- Parameters:
out- Writerencoding- Encoding- Throws:
IOException- If some output failed
-
getSize
public int getSize() -
toByteArray
public byte[] toByteArray() -
toString
-
addBuffer
protected void addBuffer() -
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
-