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.
|
finalize
protected 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
OutputStream
len
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 OutputStream
data
- 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
OutputStream
write(b, 0,
buf.length)
which is exactly how it is implemented in this
class.write
in class OutputStream
data
- The array of bytes to writeIOException
- If an error occurspublic void write(int value) throws IOException
OutputStream
int
passed as the argument.
Subclasses must provide an implementation of this method.
write
in class OutputStream
value
- The byte to be written to the output stream, passed as
the low eight bits of an int
IOException
- If an error occurspublic void flush() throws IOException
OutputStream
This method in this class does nothing.
flush
in class OutputStream
IOException
- If an error occurspublic void close() throws IOException
OutputStream
This method in this class does nothing.
close
in class OutputStream
IOException
- If an error occurs