|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.OutputStream
java.io.ByteArrayOutputStream
net.rim.device.api.io.NoCopyByteArrayOutputStream
public class NoCopyByteArrayOutputStream
Byte array output stream that returns handle to the underlying data buffer, not a copy.
This class acts exactly like a standard byte array output stream, with two exceptions:
NoCopyByteArrayOutputStream.getByteArray()
retrieves a handle to the underlying data
buffer, and not a copy of that buffer.
Field Summary |
---|
Fields inherited from class java.io.ByteArrayOutputStream |
---|
buf, count |
Constructor Summary | ||
---|---|---|
NoCopyByteArrayOutputStream()
Creates a new NoCopyByteArrayOutputStream instance. |
||
NoCopyByteArrayOutputStream(byte[] buffer,
int offset)
Creates a new NoCopyByteArrayOutputStream instance built from buffer. |
||
NoCopyByteArrayOutputStream(int size)
Creates a new NoCopyByteArrayOutputStream instance of initial size. |
Method Summary | ||
---|---|---|
byte[] |
getByteArray()
Retrieves the underlying byte array used as this stream's buffer. |
Methods inherited from class java.io.ByteArrayOutputStream |
---|
close, reset, size, toByteArray, toString, write, write |
Methods inherited from class java.io.OutputStream |
---|
flush, write |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public NoCopyByteArrayOutputStream()
Builds a new byte array output stream with an initial buffer size of 32 bytes.
public NoCopyByteArrayOutputStream(int size)
size
- Initial size for the buffer.public NoCopyByteArrayOutputStream(byte[] buffer, int offset)
buffer
- Byte array to share as output stream buffer.offset
- Initial write position.Method Detail |
---|
public byte[] getByteArray()
Unlike ByteArrayOutputStream.toByteArray()
, this method does
not create a copy of the buffer. The returned byte array will
probably be bigger than the actual size of the output stream. Use
ByteArrayOutputStream.size()
to get the actual size of the stream.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal