| java.lang.Object java.io.OutputStream org.ozoneDB.xml.util.ChunkOutputStream
Field Summary | |
final public static byte | STATE_NORMAL the output stream has not yet exceeded its initial size. | final public static byte | STATE_OVERFLOW the output stream has exceeded its initial size. | protected byte[] | buf The buffer where data is stored. | protected int | count The number of valid bytes in the buffer. | public boolean | endFlag true if this is the last chunk in a sequence of chunks, false otherwise. |
Constructor Summary | |
public | ChunkOutputStream() Creates a new byte array output stream. | public | ChunkOutputStream(int size) Creates a new byte array output stream, with a buffer capacity of
the specified size in bytes. | public | ChunkOutputStream(int size, int increase) Creates a new byte array output stream, with a buffer capacity of
the specified size in bytes. |
Method Summary | |
final public boolean | getEndFlag() | final public byte | getState() | public void | readObject(ObjectInputStream in) | final public void | reset() Resets the count field of this byte array output
stream to zero, so that all currently accumulated output in the
ouput stream is discarded. | final public void | setEndFlag() | final public int | size() The number of valid bytes in this stream. | final public byte[] | toByteArray() Creates a newly allocated byte array. | final public void | write(int b) Writes the specified byte to this byte array output stream. | final public void | write(byte[] b, int off, int len) Writes len bytes from the specified byte array
starting at offset off to this byte array output stream. | public void | writeObject(ObjectOutputStream out) | final public void | writeTo(OutputStream out) Writes the complete contents of this byte array output stream to
the specified output stream argument, as if by calling the output
stream's write method using out.write(buf, 0, count) . |
STATE_NORMAL | final public static byte STATE_NORMAL(Code) | | the output stream has not yet exceeded its initial size.
|
STATE_OVERFLOW | final public static byte STATE_OVERFLOW(Code) | | the output stream has exceeded its initial size.
|
buf | protected byte[] buf(Code) | | The buffer where data is stored.
|
count | protected int count(Code) | | The number of valid bytes in the buffer.
|
endFlag | public boolean endFlag(Code) | | true if this is the last chunk in a sequence of chunks, false otherwise.
|
ChunkOutputStream | public ChunkOutputStream()(Code) | | Creates a new byte array output stream. The buffer capacity is initially
1000 bytes. Its size increases by 100 bytes if necessary.
|
ChunkOutputStream | public ChunkOutputStream(int size)(Code) | | Creates a new byte array output stream, with a buffer capacity of
the specified size in bytes. Its size increases by 100 bytes if necessary.
Parameters: size - the initial size. exceeding this size causes thestream to enter state ChunkOutputStream.STATE_OVERFLOW. exception: IllegalArgumentException - if size is negative. |
ChunkOutputStream | public ChunkOutputStream(int size, int increase)(Code) | | Creates a new byte array output stream, with a buffer capacity of
the specified size in bytes. Its size increases by the specified increase
in bytes if necessary.
Parameters: overflowSize - the initial size. exceeding this size causes thestream to enter state ChunkOutputStream.STATE_OVERFLOW. Parameters: increase - the amount of bytes by which the stream will be incre exception: IllegalArgumentException - if size is negative orincrease is less or equal 0. |
getEndFlag | final public boolean getEndFlag()(Code) | | true, if this chunk is the last in a sequence of chunks |
getState | final public byte getState()(Code) | | the state of this output stream |
reset | final public void reset()(Code) | | Resets the count field of this byte array output
stream to zero, so that all currently accumulated output in the
ouput stream is discarded. The output stream can be used again,
reusing the already allocated buffer space.
See Also: java.io.ByteArrayInputStream.count |
setEndFlag | final public void setEndFlag()(Code) | | marks this chunk as the last in a sequence of chunks
|
size | final public int size()(Code) | | The number of valid bytes in this stream.
|
toByteArray | final public byte[] toByteArray()(Code) | | Creates a newly allocated byte array. Its size is the current
size of this output stream and the valid contents of the buffer
have been copied into it.
the current contents of this output stream, as a byte array. See Also: java.io.ByteArrayOutputStream.size |
write | final public void write(int b)(Code) | | Writes the specified byte to this byte array output stream.
Parameters: b - the byte to be written. |
write | final public void write(byte[] b, int off, int len)(Code) | | Writes len bytes from the specified byte array
starting at offset off to this byte array output stream.
Parameters: b - the data. Parameters: off - the start offset in the data. Parameters: len - the number of bytes to write. |
writeTo | final public void writeTo(OutputStream out) throws IOException(Code) | | Writes the complete contents of this byte array output stream to
the specified output stream argument, as if by calling the output
stream's write method using out.write(buf, 0, count) .
Parameters: out - the output stream to which to write the data. exception: IOException - if an I/O error occurs. |
|
|