Class OutputChunked

  • All Implemented Interfaces:
    Closeable, Flushable, AutoCloseable

    public class OutputChunked
    extends Output
    An OutputStream that buffers data in a byte array and flushes to another OutputStream, writing the length before each flush. The length allows the chunks to be skipped when reading.
    Author:
    Nathan Sweet
    • Constructor Detail

      • OutputChunked

        public OutputChunked()
        Creates an uninitialized OutputChunked with a maximum chunk size of 2048. The OutputStream must be set before it can be used.
      • OutputChunked

        public OutputChunked​(int bufferSize)
        Creates an uninitialized OutputChunked. The OutputStream must be set before it can be used.
        Parameters:
        bufferSize - The maximum size of a chunk.
      • OutputChunked

        public OutputChunked​(OutputStream outputStream)
        Creates an OutputChunked with a maximum chunk size of 2048.
      • OutputChunked

        public OutputChunked​(OutputStream outputStream,
                             int bufferSize)
        Parameters:
        bufferSize - The maximum size of a chunk.
    • Method Detail

      • endChunks

        public void endChunks()
        Marks the end of some data that may have been written by any number of chunks. These chunks can then be skipped when reading.