|
CoherenceTM v3.3 Copyright© 2000-2007 by Oracle Corporation |
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectjava.io.OutputStream
com.tangosol.io.MultiByteArrayOutputStream
public class MultiByteArrayOutputStream
An OutputStream that accumulates the written data to a series of byte arrays that do not exceed a specified size.
| Field Summary | |
|---|---|
protected byte[] |
m_ab
The current block of output. |
protected int |
m_cbBlock
The max size of each block. |
protected int |
m_cbPadBack
The number of additional bytes to allocate and leave free at the back (end) of each block |
protected int |
m_cbPadFront
The number of additional bytes to allocate and leave free at the front (start) of each block |
protected boolean |
m_fClosed
True after close is invoked. |
protected List |
m_listBlock
The list of blocks. |
protected int |
m_of
The offset into the current block of output. |
| Constructor Summary | |
|---|---|
MultiByteArrayOutputStream(int cbBlock)
Construct a MultiByteArrayOutputStream to write to byte arrays of the specified length. |
|
MultiByteArrayOutputStream(int cbBlock,
int cbPadFront,
int cbPadBack)
Construct a MultiByteArrayOutputStream to write to byte arrays of the specified length, leaving the specified amount of padding at the front and back of each byte array. |
|
| Method Summary | |
|---|---|
protected void |
check()
Verify that the stream is still open. |
void |
close()
Close the stream, flushing any accumulated bytes. |
void |
flush()
Flush any accumulated bytes. |
int |
getBackPaddingSize()
Determine the number of extra bytes of padding that will be allocated and left blank at the end of each block after the data portion. |
byte[] |
getBlock(int i)
Obtain the specified block of data that was written. |
int |
getBlockCount()
Determine the number of blocks that have been written thus far. |
int |
getBlockDataSize()
Determine the maximum number of bytes of data that will be stored in each block. |
int |
getFrontPaddingSize()
Determine the number of extra bytes of padding that will be allocated and left blank at the start of each block in front of the data portion. |
protected int |
requestCapacity(int cbMore)
Ensure that the current block contains some available capacity, preferably enough to fulfill the specified capacity. |
String |
toString()
Create a human readable string representing the data written to the stream. |
void |
write(byte[] abSrc,
int ofSrc,
int cbSrc)
Writes len bytes from the specified byte array
starting at offset off to this output stream. |
void |
write(int b)
Writes the specified byte to this output stream. |
| Methods inherited from class java.io.OutputStream |
|---|
write |
| Methods inherited from interface com.tangosol.io.OutputStreaming |
|---|
write |
| Field Detail |
|---|
protected byte[] m_ab
protected int m_of
protected int m_cbBlock
protected int m_cbPadFront
protected int m_cbPadBack
protected List m_listBlock
protected boolean m_fClosed
| Constructor Detail |
|---|
public MultiByteArrayOutputStream(int cbBlock)
cbBlock - the number of bytes (maximum) per block
public MultiByteArrayOutputStream(int cbBlock,
int cbPadFront,
int cbPadBack)
cbBlock - the number of data bytes (maximum) per blockcbPadFront - the number of additional bytes to allocate and
leave free at the front (start) of each blockcbPadBack - the number of additional bytes to allocate and
leave free at the back (end) of each block| Method Detail |
|---|
public void write(int b)
throws IOException
write in interface OutputStreamingwrite in class OutputStreamb - the byte.
IOException - if an I/O error occurs. In particular,
an IOException may be thrown if the
output stream has been closed.
public void write(byte[] abSrc,
int ofSrc,
int cbSrc)
throws IOException
len bytes from the specified byte array
starting at offset off to this output stream.
If b is null, a
NullPointerException is thrown.
If off is negative, or len is negative, or
off+len is greater than the length of the array
b, then an IndexOutOfBoundsException is thrown.
write in interface OutputStreamingwrite in class OutputStreamabSrc - the dataofSrc - the start offset in the datacbSrc - the number of bytes to write
IOException - if an I/O error occurs. In particular,
an IOException is thrown if the output
stream is closed.
public void flush()
throws IOException
flush in interface OutputStreamingflush in interface Flushableflush in class OutputStreamIOException - if an I/O error occurs
public void close()
throws IOException
close in interface OutputStreamingclose in interface Closeableclose in class OutputStreamIOException - if an I/O error occurspublic String toString()
public int getBlockCount()
public byte[] getBlock(int i)
i - block index in the range 0..getBlocKCount()-1
public int getBlockDataSize()
public int getFrontPaddingSize()
public int getBackPaddingSize()
protected void check()
throws IOException
IOExceptionprotected int requestCapacity(int cbMore)
cbMore - the requested capacity
|
CoherenceTM v3.3 Copyright© 2000-2007 by Oracle Corporation |
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||