public class PGPLiteralDataGenerator
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static char |
BINARY |
static java.lang.String |
CONSOLE
The special name indicating a "for your eyes only" packet.
|
static java.util.Date |
NOW
The special time for a modification time of "now" or
the present time.
|
static char |
TEXT |
static char |
UTF8 |
Constructor and Description |
---|
PGPLiteralDataGenerator() |
PGPLiteralDataGenerator(boolean oldFormat)
Generates literal data objects in the old format, this is
important if you need compatability with PGP 2.6.x.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the literal data packet - this is equivalent to calling close on the stream
returned by the open() method.
|
java.io.OutputStream |
open(java.io.OutputStream out,
char format,
java.io.File file)
Open a literal data packet for the passed in File object, returning
an output stream for saving the file contents.
|
java.io.OutputStream |
open(java.io.OutputStream out,
char format,
java.lang.String name,
java.util.Date modificationTime,
byte[] buffer)
Open a literal data packet, returning a stream to store the data inside
the packet as an indefinite length stream.
|
java.io.OutputStream |
open(java.io.OutputStream out,
char format,
java.lang.String name,
long length,
java.util.Date modificationTime)
Open a literal data packet, returning a stream to store the data inside
the packet.
|
public static final char BINARY
public static final char TEXT
public static final char UTF8
public static final java.lang.String CONSOLE
public static final java.util.Date NOW
public PGPLiteralDataGenerator()
public PGPLiteralDataGenerator(boolean oldFormat)
oldFormat
- public java.io.OutputStream open(java.io.OutputStream out, char format, java.lang.String name, long length, java.util.Date modificationTime) throws java.io.IOException
The stream created can be closed off by either calling close() on the stream or close() on the generator. Closing the returned stream does not close off the OutputStream parameter out.
out
- the stream we want the packet informat
- the format we are usingname
- the name of the "file"length
- the length of the data we will writemodificationTime
- the time of last modification we want stored.java.io.IOException
public java.io.OutputStream open(java.io.OutputStream out, char format, java.lang.String name, java.util.Date modificationTime, byte[] buffer) throws java.io.IOException
The stream created can be closed off by either calling close() on the stream or close() on the generator. Closing the returned stream does not close off the OutputStream parameter out.
Note: if the buffer is not a power of 2 in length only the largest power of 2 bytes worth of the buffer will be used.
out
- the stream we want the packet informat
- the format we are usingname
- the name of the "file"modificationTime
- the time of last modification we want stored.buffer
- the buffer to use for collecting data to put into chunks.java.io.IOException
public java.io.OutputStream open(java.io.OutputStream out, char format, java.io.File file) throws java.io.IOException
The stream created can be closed off by either calling close() on the stream or close() on the generator. Closing the returned stream does not close off the OutputStream parameter out.
out
- format
- file
- java.io.IOException
public void close() throws java.io.IOException
java.io.IOException