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 void
void
close()
int
getSize()
byte[]
toString()
void
write
(byte[] data, int offset, int length) void
write
(int datum) void
This is a patched method (standard)void
writeTo
(OutputStream out) void
writeTo
(RandomAccessFile out) void
This 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:
write
in classOutputStream
- Throws:
IOException
-
write
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classOutputStream
-