Module org.hsqldb
Package org.hsqldb.lib.tar

## Class TarGenerator

- java.lang.Object
- - org.hsqldb.lib.tar.TarGenerator

-     public class TarGenerator
      extends java.lang.Object

  Generates a tar archive from specified Files and InputStreams. Modified by fredt for hot backup
  Since:
    2.0.0
  Author:
    Blaine Simpson (blaine dot simpson at admc dot com)

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `TarGenerator​(java.io.File inFile, boolean overWrite, java.lang.Integer blocksPerRecord)` | Compression is determined directly by the suffix of the file name in the specified path.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `long` | `getPaxThreshold()` |
    `void` | `queueEntry​(java.io.File file)` |
    `void` | `queueEntry​(java.lang.String entryPath, java.io.File file)` |
    `void` | `queueEntry​(java.lang.String entryPath, java.io.InputStream inStream, int maxBytes)` | This method does not support Pax Interchange Format, nor data sizes greater than 2G.
    `void` | `queueEntry​(java.lang.String entryPath, InputStreamInterface is)` |
    `void` | `setPaxThreshold​(long paxThreshold)` | When data file is this size or greater, in bytes, a Pix Interchange Format 'x' record will be created and used for the file entry.
    `void` | `write()` | This method does release all of the streams, even if there is a failure.

    - ### Methods inherited from class java.lang.Object

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

- - ### Constructor Detail

    - #### TarGenerator

          public TarGenerator​(java.io.File inFile,
                              boolean overWrite,
                              java.lang.Integer blocksPerRecord)
                       throws java.io.IOException

      Compression is determined directly by the suffix of the file name in the specified path.
      Parameters:
        `inFile` - Absolute or relative (from user.dir) File for tar file to be created. getName() Suffix must indicate tar file and may indicate a compression method.
        `overWrite` - True to replace an existing file of same path.
        `blocksPerRecord` - Null will use default tar value.
      Throws:
        `java.io.IOException` - on access failure

  - ### Method Detail

    - #### setPaxThreshold

          public void setPaxThreshold​(long paxThreshold)

      When data file is this size or greater, in bytes, a Pix Interchange Format 'x' record will be created and used for the file entry.

      Limitation At this time, PAX is only implemented for entries added as Files, not entries added as Stream.

      Parameters:
        `paxThreshold` - long

    - #### getPaxThreshold

          public long getPaxThreshold()

      Returns:
        long
      See Also:
        `setPaxThreshold(long)`

    - #### queueEntry

          public void queueEntry​(java.io.File file)
                          throws java.io.FileNotFoundException,
                                 TarMalformatException

      Throws:
        `java.io.FileNotFoundException`
        `TarMalformatException`

    - #### queueEntry

          public void queueEntry​(java.lang.String entryPath,
                                 java.io.File file)
                          throws java.io.FileNotFoundException,
                                 TarMalformatException

      Throws:
        `java.io.FileNotFoundException`
        `TarMalformatException`

    - #### queueEntry

          public void queueEntry​(java.lang.String entryPath,
                                 InputStreamInterface is)
                          throws java.io.FileNotFoundException,
                                 TarMalformatException

      Throws:
        `java.io.FileNotFoundException`
        `TarMalformatException`

    - #### queueEntry

          public void queueEntry​(java.lang.String entryPath,
                                 java.io.InputStream inStream,
                                 int maxBytes)
                          throws java.io.IOException,
                                 TarMalformatException

      This method does not support Pax Interchange Format, nor data sizes greater than 2G.

      This limitation may or may not be eliminated in the future.

      Parameters:
        `entryPath` - String
        `inStream` - InputStream
        `maxBytes` - int
      Throws:
        `java.io.IOException` - on access failure
        `TarMalformatException` - if malformed

    - #### write

          public void write()
                     throws java.io.IOException,
                            TarMalformatException

      This method does release all of the streams, even if there is a failure.
      Throws:
        `java.io.IOException` - on access failure
        `TarMalformatException` - if malformed