public class EXRByteArrayOutputStream extends Object implements EXROutputStream
array()
Constructor and Description |
---|
EXRByteArrayOutputStream()
Creates a new byte array output stream, with an initial buffer capacity
of 512 bytes.
|
EXRByteArrayOutputStream(int size)
Creates a new byte array output stream, with a buffer capacity of
the specified size, in bytes.
|
Modifier and Type | Method and Description |
---|---|
byte[] |
array()
Returns the byte array that backs this output stream.
|
long |
position()
Get the current writing position, in bytes from the beginning of the
stream.
|
EXROutputStream |
position(long pos)
Set the current position.
|
void |
write(ByteBuffer src)
Write to the stream.
|
public EXRByteArrayOutputStream(int size)
size
- the initial sizeIllegalArgumentException
- if size is negativepublic EXRByteArrayOutputStream()
public byte[] array()
The array contains valid data in the interval [0, position())
.
Modifications to this buffer's content will cause the returned array's
content to be modified, and vice versa.
public void write(ByteBuffer src) throws EXRIOException
EXROutputStream
write(dst)
writes n bytes to the stream, where
n is the number of bytes remaining in the buffer, that is,
dst.remaining()
, at the moment this method is invoked. The bytes
are written from the current position of the buffer.
If an I/O error occurs, write(dst)
throws an exception.
write
in interface EXROutputStream
src
- The buffer from which bytes are to be transferredEXRIOException
- if an I/O error occurs.public long position() throws EXRIOException
EXROutputStream
write()
will write the first byte in
the stream, position()
returns 0.position
in interface EXROutputStream
EXRIOException
- if an I/O error occurs.public EXROutputStream position(long pos) throws EXRIOException
EXROutputStream
position(i)
,
position()
returns i.position
in interface EXROutputStream
pos
- the new writing position.EXRIOException