- 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()
-
-
-
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
- Stringb
- boolean value- Throws:
TarMalformatException
- if there is a problem writing the tar filejava.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
- Stringi
- int value- Throws:
TarMalformatException
- if there is a problem writing the tar filejava.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
- Stringl
- long value- Throws:
TarMalformatException
- if there is a problem writing the tar filejava.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
- Stringvalue
- String- Throws:
TarMalformatException
- if there is a problem writing the tar filejava.io.IOException
- if there is an IO problem
-
-