Class InputChunked

All Implemented Interfaces:
Closeable, AutoCloseable

public class InputChunked extends Input
An InputStream that reads lengths and chunks of data from another OutputStream, allowing chunks to be skipped.
  • Field Details

    • chunkSize

      private int chunkSize
  • Constructor Details

    • InputChunked

      public InputChunked()
      Creates an uninitialized InputChunked with a buffer size of 2048. The InputStream must be set before it can be used.
    • InputChunked

      public InputChunked(int bufferSize)
      Creates an uninitialized InputChunked. The InputStream must be set before it can be used.
    • InputChunked

      public InputChunked(InputStream inputStream)
      Creates an InputChunked with a buffer size of 2048.
    • InputChunked

      public InputChunked(InputStream inputStream, int bufferSize)
  • Method Details

    • setInputStream

      public void setInputStream(InputStream inputStream)
      Description copied from class: Input
      Sets a new InputStream. The position and total are reset, discarding any buffered bytes.
      Overrides:
      setInputStream in class Input
      Parameters:
      inputStream - May be null.
    • setBuffer

      public void setBuffer(byte[] bytes, int offset, int count)
      Description copied from class: Input
      Sets a new buffer. The position and total are reset, discarding any buffered bytes.
      Overrides:
      setBuffer in class Input
    • rewind

      public void rewind()
      Description copied from class: Input
      Sets the position and total to zero.
      Overrides:
      rewind in class Input
    • fill

      protected int fill(byte[] buffer, int offset, int count) throws KryoException
      Description copied from class: Input
      Fills the buffer with more bytes. Can be overridden to fill the bytes from a source other than the InputStream.
      Overrides:
      fill in class Input
      Returns:
      -1 if there are no more bytes.
      Throws:
      KryoException
    • readChunkSize

      private void readChunkSize()
    • nextChunks

      public void nextChunks()
      Advances the stream to the next set of chunks. InputChunked will appear to hit the end of the data until this method is called.