Package org.apache.commons.compress.parallel

# Class FileBasedScatterGatherBackingStore

java.lang.Object
org.apache.commons.compress.parallel.FileBasedScatterGatherBackingStore

All Implemented Interfaces:
  `Closeable`, `AutoCloseable`, `ScatterGatherBackingStore`

public class FileBasedScatterGatherBackingStore extends Object implements ScatterGatherBackingStore
ScatterGatherBackingStore that is backed by a path.

Since:
  1.10

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `FileBasedScatterGatherBackingStore(File target)`
  Constructs a new instance.
  `FileBasedScatterGatherBackingStore(Path target)`
  Constructs a new instance for the given path.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `close()`
  `void`
  `closeForWriting()`
  Closes this backing store for further writing.
  `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 class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### FileBasedScatterGatherBackingStore

    public FileBasedScatterGatherBackingStore(File target) throws FileNotFoundException
    Constructs a new instance.
    Parameters:
      `target` - The path to offload compressed data into.
    Throws:
      `FileNotFoundException` - if the file doesn't exist.

  - ### FileBasedScatterGatherBackingStore

    public FileBasedScatterGatherBackingStore(Path target) throws FileNotFoundException
    Constructs a new instance for the given path.
    Parameters:
      `target` - The path to offload compressed data into.
    Throws:
      `FileNotFoundException` - if the file doesn't exist.
    Since:
      1.22

- ## Method Details

  - ### close

    public void close() throws IOException
    Specified by:
      `close` in interface `AutoCloseable`
    Specified by:
      `close` in interface `Closeable`
    Throws:
      `IOException`

  - ### closeForWriting

    public void closeForWriting() throws IOException
    Description copied from interface: `ScatterGatherBackingStore`
    Closes this backing store for further writing.
    Specified by:
      `closeForWriting` in interface `ScatterGatherBackingStore`
    Throws:
      `IOException` - if an I/O error occurs.

  - ### getInputStream

    public InputStream getInputStream() throws IOException
    Description copied from interface: `ScatterGatherBackingStore`
    An input stream that contains the scattered payload
    Specified by:
      `getInputStream` in interface `ScatterGatherBackingStore`
    Returns:
      An InputStream, should be closed by the caller of this method.
    Throws:
      `IOException` - if an I/O error occurs.

  - ### writeOut

    public void writeOut(byte[] data, int offset, int length) throws IOException
    Description copied from interface: `ScatterGatherBackingStore`
    Writes a piece of payload.
    Specified by:
      `writeOut` in interface `ScatterGatherBackingStore`
    Parameters:
      `data` - the data to write
      `offset` - offset inside data to start writing from
      `length` - the amount of data to write
    Throws:
      `IOException` - if an I/O error occurs.