Package org.apache.myfaces.util.lang
Class FastByteArrayOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- org.apache.myfaces.util.lang.FastByteArrayOutputStream
-
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
public class FastByteArrayOutputStream extends OutputStream
ByteArrayOutputStream implementation that doesn't synchronize methods and doesn't copy the data on toByteArray().
-
-
Constructor Summary
Constructors Constructor Description FastByteArrayOutputStream()
FastByteArrayOutputStream(int size)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
getByteArray()
Returns the byte array containing the written data.InputStream
getInputStream()
Returns a ByteArrayInputStream for reading back the written dataint
getSize()
void
reset()
void
write(byte[] b)
void
write(byte[] b, int off, int len)
void
write(int b)
-
Methods inherited from class java.io.OutputStream
close, flush, nullOutputStream
-
-
-
-
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 final void write(byte[] b)
- Overrides:
write
in classOutputStream
-
write
public final void write(byte[] b, int off, int len)
- Overrides:
write
in classOutputStream
-
write
public final void write(int b)
- Specified by:
write
in classOutputStream
-
reset
public void reset()
-
getInputStream
public InputStream getInputStream()
Returns a ByteArrayInputStream for reading back the written data
-
-