public class ChunkedDataOutputStream extends OutputStream
| Modifier and Type | Field and Description |
|---|---|
protected byte[] |
buffer |
protected int |
inBuffer |
protected OutputStream |
out |
| Constructor and Description |
|---|
ChunkedDataOutputStream(OutputStream out,
int chunkSize) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
This method closes the stream.
|
void |
flush()
This method forces any data that may have been buffered to be written
to the underlying output device.
|
void |
write(byte[] data)
This method all the writes bytes from the passed array to the
output stream.
|
void |
write(byte[] data,
int offset,
int length)
This method writes
len bytes from the specified array
b starting at index off into the array. |
void |
write(int value)
This method writes a single byte to the output stream.
|
finalizeprotected OutputStream out
protected int inBuffer
protected byte[] buffer
public ChunkedDataOutputStream(OutputStream out, int chunkSize)
public void write(byte[] data,
int offset,
int length)
throws IOException
OutputStreamlen bytes from the specified array
b starting at index off into the array.
This method in this class calls the single byte write()
method in a loop until all bytes have been written. Subclasses should
override this method if possible in order to provide a more efficent
implementation.
write in class OutputStreamdata - The array of bytes to write fromoffset - The index into the array to start writing fromlength - The number of bytes to writeIOException - If an error occurspublic void write(byte[] data)
throws IOException
OutputStreamwrite(b, 0,
buf.length) which is exactly how it is implemented in this
class.write in class OutputStreamdata - The array of bytes to writeIOException - If an error occurspublic void write(int value)
throws IOException
OutputStreamint passed as the argument.
Subclasses must provide an implementation of this method.
write in class OutputStreamvalue - The byte to be written to the output stream, passed as
the low eight bits of an intIOException - If an error occurspublic void flush()
throws IOException
OutputStreamThis method in this class does nothing.
flush in class OutputStreamIOException - If an error occurspublic void close()
throws IOException
OutputStreamThis method in this class does nothing.
close in class OutputStreamIOException - If an error occurs