org.jppf.utils.streams
Class JPPFByteArrayOutputStream
java.lang.Object
java.io.OutputStream
java.io.ByteArrayOutputStream
org.jppf.utils.streams.JPPFByteArrayOutputStream
- All Implemented Interfaces:
- Closeable, Flushable
public class JPPFByteArrayOutputStream
- extends ByteArrayOutputStream
Extension of ByteArrayOutputStream, providing
a faster toByteArray() method that does not involve copying its internal buffer.
- Author:
- Laurent Cohen
|
Method Summary |
byte[] |
getBuf()
Provide access to the internal buffer. |
byte[] |
toByteArray()
Override of toByteArray() that returns a reference to the internal buffer
instead of copy of it, significantly increasing the performance of this operation. |
JPPFByteArrayOutputStream
public JPPFByteArrayOutputStream()
- Instantiate this stream with a default size.
JPPFByteArrayOutputStream
public JPPFByteArrayOutputStream(int size)
- Instantiate this stream with the specified size.
- Parameters:
size - the initial size of the underlying buffer.
toByteArray
public byte[] toByteArray()
- Override of
toByteArray() that returns a reference to the internal buffer
instead of copy of it, significantly increasing the performance of this operation.
- Overrides:
toByteArray in class ByteArrayOutputStream
- Returns:
- the content of the stream as an array of bytes.
- See Also:
ByteArrayOutputStream.toByteArray()
getBuf
public byte[] getBuf()
- Provide access to the internal buffer.
- Returns:
- an array of bytes.
Copyright © 2005-2010 JPPF Team.