|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.io.OutputStream java.io.FilterOutputStream java.io.DataOutputStream org.w3c.www.http.ChunkedOutputStream
public class ChunkedOutputStream
Field Summary | |
---|---|
protected byte[] |
bheader
Internal buffer to hold chunk size. |
protected byte[] |
buffer
The chunking buffer. |
protected int |
bufptr
Where to put next piece of data (current chunk size). |
protected int |
chunksize
The chunk size to use (defaults to buffer size). |
Fields inherited from class java.io.DataOutputStream |
---|
written |
Fields inherited from class java.io.FilterOutputStream |
---|
out |
Constructor Summary | |
---|---|
ChunkedOutputStream(byte[] buffer,
java.io.DataOutputStream out)
Create a chunk encoder, using the provided buffer. |
|
ChunkedOutputStream(java.io.DataOutputStream out)
Create a chunk encoder. |
Method Summary | |
---|---|
protected void |
append(byte[] b,
int off,
int len)
Append a bunch of bytes to current pending chunk. |
protected void |
append(int v)
Append one byte to pending chunk. |
void |
close()
Close that encoding stream. |
void |
close(boolean really)
Close that encoding stream. |
void |
flush()
Flush pending output. |
protected void |
sendChunk()
Send current chunk of data. |
protected void |
sendChunk(byte[] b,
int off,
int len)
Send given buffer as a full chunk. |
protected void |
sendClose()
Send the close chunk. |
void |
write(byte[] b,
int off,
int len)
Write an array of bytes. |
void |
write(int b)
Write one byte of output. |
Methods inherited from class java.io.DataOutputStream |
---|
size, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTF |
Methods inherited from class java.io.FilterOutputStream |
---|
write |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.io.DataOutput |
---|
write |
Field Detail |
---|
protected byte[] buffer
protected int bufptr
protected int chunksize
protected byte[] bheader
Constructor Detail |
---|
public ChunkedOutputStream(byte[] buffer, java.io.DataOutputStream out)
buffer
- The buffer to use (determines the default chunk size).put
- The DataOutputStream to write encoded data to.public ChunkedOutputStream(java.io.DataOutputStream out)
out
- The DataOutputStream to write to.Method Detail |
---|
protected void sendClose() throws java.io.IOException
java.io.IOException
protected void sendChunk(byte[] b, int off, int len) throws java.io.IOException
b
- The buffer that contains the data to emit.off
- Offset of chunk in above buffer.len
- Length of chunk.
java.io.IOException
- If writing fails.protected void sendChunk() throws java.io.IOException
java.io.IOException
- If writing fails.protected final void append(int v) throws java.io.IOException
v
- The byte to append.
java.io.IOException
- If writing fails.protected final void append(byte[] b, int off, int len) throws java.io.IOException
b
- The chunk of bytes to add.off
- Offset of chunk within above buffer.len
- Length of chunk.
java.io.IOException
- If writing fails.public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in class java.io.FilterOutputStream
java.io.IOException
- If writing fails.public void close(boolean really) throws java.io.IOException
java.io.IOException
- If writing fails.public void flush() throws java.io.IOException
flush
in interface java.io.Flushable
flush
in class java.io.DataOutputStream
java.io.IOException
- If writing fails.public void write(int b) throws java.io.IOException
write
in interface java.io.DataOutput
write
in class java.io.DataOutputStream
v
- The byte to write.
java.io.IOException
- If writing fails.public void write(byte[] b, int off, int len) throws java.io.IOException
write
in interface java.io.DataOutput
write
in class java.io.DataOutputStream
b
- The data to write.off
- Offfset within above buffer.len
- Length of data to write.
java.io.IOException
- If writing fails.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |