Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.w3c.www.http
Class ChunkedOutputStream

    java.lang.Object
      |
      +--java.io.OutputStream
            |
            +--java.io.FilterOutputStream
                  |
                  +--java.io.DataOutputStream
                        |
                        +--org.w3c.www.http.ChunkedOutputStream

public class ChunkedOutputStream
extends java.io.DataOutputStream

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`

Field Detail

### buffer

    protected byte[] buffer

  The chunking buffer.

### bufptr

    protected int bufptr

  Where to put next piece of data (current chunk size).

### chunksize

    protected int chunksize

  The chunk size to use (defaults to buffer size).

### bheader

    protected byte[] bheader

  Internal buffer to hold chunk size.

Constructor Detail

### ChunkedOutputStream

    public ChunkedOutputStream(byte[] buffer,
                               java.io.DataOutputStream out)

  Create a chunk encoder, using the provided buffer.
  Parameters:
    `buffer` - The buffer to use (determines the default chunk size).
    `put` - The DataOutputStream to write encoded data to.

### ChunkedOutputStream

    public ChunkedOutputStream(java.io.DataOutputStream out)

  Create a chunk encoder.
  Parameters:
    `out` - The DataOutputStream to write to.

Method Detail

### sendClose

    protected void sendClose()
                      throws java.io.IOException

  Send the close chunk.

### sendChunk

    protected void sendChunk(byte[] b,
                             int off,
                             int len)
                      throws java.io.IOException

  Send given buffer as a full chunk.
  Parameters:
    `b` - The buffer that contains the data to emit.
    `off` - Offset of chunk in above buffer.
    `len` - Length of chunk.
  Throws:
    java.io.IOException - If writing fails.

### sendChunk

    protected void sendChunk()
                      throws java.io.IOException

  Send current chunk of data.
  Throws:
    java.io.IOException - If writing fails.

### append

    protected final void append(int v)
                         throws java.io.IOException

  Append one byte to pending chunk.
  Parameters:
    `v` - The byte to append.
  Throws:
    java.io.IOException - If writing fails.

### append

    protected final void append(byte[] b,
                                int off,
                                int len)
                         throws java.io.IOException

  Append a bunch of bytes to current pending chunk.
  Parameters:
    `b` - The chunk of bytes to add.
    `off` - Offset of chunk within above buffer.
    `len` - Length of chunk.
  Throws:
    java.io.IOException - If writing fails.

### close

    public void close()
               throws java.io.IOException

  Close that encoding stream.
  Overrides:
    close in class java.io.FilterOutputStream
  Throws:
    java.io.IOException - If writing fails.

### close

    public void close(boolean really)
               throws java.io.IOException

  Close that encoding stream.
  Throws:
    java.io.IOException - If writing fails.

### flush

    public void flush()
               throws java.io.IOException

  Flush pending output.
  Overrides:
    flush in class java.io.DataOutputStream
  Throws:
    java.io.IOException - If writing fails.

### write

    public void write(int b)
               throws java.io.IOException

  Write one byte of output.
  Overrides:
    write in class java.io.DataOutputStream
  Parameters:
    `v` - The byte to write.
  Throws:
    java.io.IOException - If writing fails.

### write

    public void write(byte[] b,
                      int off,
                      int len)
               throws java.io.IOException

  Write an array of bytes.
  Overrides:
    write in class java.io.DataOutputStream
  Parameters:
    `b` - The data to write.
    `off` - Offfset within above buffer.
    `len` - Length of data to write.
  Throws:
    java.io.IOException - If writing fails.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD