ScatterGatherBackingStore
Date: 2017-02-08

org.apache.commons.compress.parallel

## Interface ScatterGatherBackingStore

- All Superinterfaces:
    java.lang.AutoCloseable, java.io.Closeable
  All Known Implementing Classes:
    FileBasedScatterGatherBackingStore

      public interface ScatterGatherBackingStore
      extends java.io.Closeable

  Store intermediate payload in a scatter-gather scenario. Multiple threads write their payload to a backing store, which can subsequently be reversed to an `InputStream` to be used as input in the gather phase.

  It is the responsibility of the allocator of an instance of this class to close this. Closing it should clear off any allocated structures and preferably delete files.

  Since:
    1.10

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `closeForWriting()` Closes this backing store for further writing.
    `java.io.InputStream` | `getInputStream()` An input stream that contains the scattered payload
    `void` | `writeOut(byte[] data, int offset, int length)` Writes a piece of payload.

    - ### Methods inherited from interface java.io.Closeable

      `close`

- - ### Method Detail

    - #### getInputStream

          java.io.InputStream getInputStream()
                                             throws java.io.IOException

      An input stream that contains the scattered payload
      Returns:
        An InputStream, should be closed by the caller of this method.
      Throws:
        `java.io.IOException` - when something fails

    - #### writeOut

          void writeOut(byte[] data,
                      int offset,
                      int length)
                        throws java.io.IOException

      Writes a piece of payload.
      Parameters:
        `data` - the data to write
        `offset` - offset inside data to start writing from
        `length` - the amount of data to write
      Throws:
        `java.io.IOException` - when something fails

    - #### closeForWriting

          void closeForWriting()
                               throws java.io.IOException

      Closes this backing store for further writing.
      Throws:
        `java.io.IOException` - when something fails