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

## Class PIFGenerator

- java.lang.Object
- - java.io.OutputStream
  - - java.io.ByteArrayOutputStream
    - - org.hsqldb.lib.tar.PIFGenerator

- All Implemented Interfaces:
    `java.io.Closeable`, `java.io.Flushable`, `java.lang.AutoCloseable`

      public class PIFGenerator
      extends java.io.ByteArrayOutputStream

  Encapsulates Pax Interchange Format key-value pairs.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `PIFGenerator​(int sequenceNum)` | Construct a PIFGenerator object for a 'g' record.
    `PIFGenerator​(java.io.File file)` | Construct a PIFGenerator object for a 'x' record.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `addRecord​(java.lang.String key, boolean b)` | Convenience wrapper for addRecord(String, String).
    `void` | `addRecord​(java.lang.String key, int i)` | Convenience wrapper for addRecord(String, String).
    `void` | `addRecord​(java.lang.String key, long l)` | Convenience wrapper for addRecord(String, String).
    `void` | `addRecord​(java.lang.String key, java.lang.String value)` | I guess the "initial length" field is supposed to be in units of characters, not bytes?
    `java.lang.String` | `getName()` |

    - ### Methods inherited from class java.io.ByteArrayOutputStream

      `close, reset, size, toByteArray, toString, toString, toString, toString, write, write, writeBytes, writeTo`

    - ### Methods inherited from class java.io.OutputStream

      `flush, nullOutputStream, write`

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

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

- - ### Constructor Detail

    - #### PIFGenerator

          public PIFGenerator​(int sequenceNum)

      Construct a PIFGenerator object for a 'g' record.
      Parameters:
        `sequenceNum` - Index starts at 1 in each Tar file

    - #### PIFGenerator

          public PIFGenerator​(java.io.File file)

      Construct a PIFGenerator object for a 'x' record.
      Parameters:
        `file` - Target file of the x record.

  - ### Method Detail

    - #### getName

          public java.lang.String getName()

    - #### addRecord

          public void addRecord​(java.lang.String key,
                                boolean b)
                         throws TarMalformatException,
                                java.io.IOException

      Convenience wrapper for addRecord(String, String). N.b. this writes values exactly as either "true" or "false".
      Parameters:
        `key` - String
        `b` - boolean value
      Throws:
        `TarMalformatException` - if there is a problem writing the tar file
        `java.io.IOException` - if there is an IO problem
      See Also:
        `addRecord(String, String)`, `Boolean.toString(boolean)`

    - #### addRecord

          public void addRecord​(java.lang.String key,
                                int i)
                         throws TarMalformatException,
                                java.io.IOException

      Convenience wrapper for addRecord(String, String).
      Parameters:
        `key` - String
        `i` - int value
      Throws:
        `TarMalformatException` - if there is a problem writing the tar file
        `java.io.IOException` - IOException if there is an IO problem
      See Also:
        `addRecord(String, String)`

    - #### addRecord

          public void addRecord​(java.lang.String key,
                                long l)
                         throws TarMalformatException,
                                java.io.IOException

      Convenience wrapper for addRecord(String, String).
      Parameters:
        `key` - String
        `l` - long value
      Throws:
        `TarMalformatException` - if there is a problem writing the tar file
        `java.io.IOException` - if there is an IO problem
      See Also:
        `addRecord(String, String)`

    - #### addRecord

          public void addRecord​(java.lang.String key,
                                java.lang.String value)
                         throws TarMalformatException,
                                java.io.IOException

      I guess the "initial length" field is supposed to be in units of characters, not bytes?
      Parameters:
        `key` - String
        `value` - String
      Throws:
        `TarMalformatException` - if there is a problem writing the tar file
        `java.io.IOException` - if there is an IO problem