public class ChunkedMessageBodyOutputStream extends OutputStream
Each chunk starts with the number of octets of the data it embeds, expressed as a hexadecimal numbers in ASCII and a terminating CRLF sequence, followed by the chunk data. The chunk is terminated by CRLF.
| Constructor and Description |
|---|
ChunkedMessageBodyOutputStream(OutputStream os)
Creates a new instance of
ChunkedMessageBodyOutputStream using the specified OutputStream as the
underlying OutputStream. |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close this output stream.
|
void |
flush()
Writes the pending data and flush underlying stream.
|
void |
write(byte[] b,
int off,
int len)
Writes the content of the byte array
b from the offset off in length len
in chunked encoding using the underlying OutputStream. |
void |
write(int b)
Write one byte of data.
|
writepublic ChunkedMessageBodyOutputStream(OutputStream os)
ChunkedMessageBodyOutputStream using the specified OutputStream as the
underlying OutputStream.os - the underlying OutputStream to usepublic final void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class OutputStreamIOException - when an error occurs while closing the streampublic final void flush()
throws IOException
flush in interface Flushableflush in class OutputStreamIOException - when the connection is closed.public final void write(byte[] b,
int off,
int len)
throws IOException
b from the offset off in length len
in chunked encoding using the underlying OutputStream.write in class OutputStreamb - the byte arrayoff - the starting index in byte array blen - the number of bytes written to the underlying Output stream in chunked encoding.IOException - if the ChunkedMessageBodyOutputStream is already closed.public final void write(int b)
throws IOException
write in class OutputStreamb - the byte to write to the underlying OutputStreamIOException - if the ChunkedMessageBodyOutputStream is already closed.OutputStream.write(int)