All Implemented Interfaces:
Closeable, Flushable, AutoCloseable

public class DechunkedOutputStreamextends LimitOutputStream
Simple stream for checking and optionally removing RFC2616 chunked encoding to the output.
  • Field Details

    • _strip

      private final boolean _strip
      True to strip the chunk headers and footers.
    • _state

      The current state of the chunk parser.
    • _remaining

      private int _remaining
      Bytes left in the current chunk, or the trailer header size.
  • Constructor Details

    • DechunkedOutputStream

      public DechunkedOutputStream(OutputStream raw, LimitOutputStream.DoneCallback callback, boolean strip)
      Creates a new dechunked output stream.
      Parameters:
      raw - the underlying output stream
      callback - callback invoked when chunking is complete
      strip - true to strip chunk headers/footers, false to pass them through
  • Method Details

    • write

      public void write(byte[] buf, int off, int len) throws IOException
      Description copied from class: LimitOutputStream
      Subclasses MUST override the following method such that it calls done() when finished and throws EOFException if called again.
      Overrides:
      write in class LimitOutputStream
      Throws:
      IOException