|
Bouncy Castle Cryptography 1.71 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.bouncycastle.openpgp.PGPCanonicalizedDataGenerator
Generator for producing filtered literal data packets which are automatically canonicalized.
PGPCanonicalizedDataGenerator is used by invoking one of the open functions to create an OutputStream that raw data can be supplied to for encoding:
open(OutputStream, char, String, Date)
to create a packet containing a single
literal data object.open(OutputStream, char, String, Date, byte[])
to create a packet consisting of a series
of literal data objects (partials).
A PGPCanonicalizedDataGenerator is usually used to wrap the OutputStream
obtained
from a
PGPEncryptedDataGenerator
or a PGPCompressedDataGenerator
.
Once literal data has been written to the constructed OutputStream, writing of the object stream
is completed by closing the OutputStream obtained from the open()
method, or
equivalently invoking close()
on this generator.
Field Summary | |
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
Format tag for textual literal data |
static char |
UTF8
Format tag for UTF-8 encoded textual literal data |
Constructor Summary | |
PGPCanonicalizedDataGenerator()
Constructs a generator for literal data objects. |
|
PGPCanonicalizedDataGenerator(boolean oldFormat)
Constructs a generator for literal data objects, specifying to use new or old (PGP 2.6.x compatible) format. |
Method Summary | |
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)
Open a literal data packet, returning a stream to store the data inside the packet. |
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,
java.util.Date modificationTime,
java.io.File backingFile)
Open a literal data packet, returning a stream to store the data inside the packet. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public static final char TEXT
public static final char UTF8
public static final java.lang.String CONSOLE
public static final java.util.Date NOW
Constructor Detail |
public PGPCanonicalizedDataGenerator()
public PGPCanonicalizedDataGenerator(boolean oldFormat)
This can be used for compatibility with PGP 2.6.x.
oldFormat
- true
to use PGP 2.6.x compatible format.Method Detail |
public java.io.OutputStream open(java.io.OutputStream out, char format, java.lang.String name, 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 underlying output stream to write the literal data packet to.format
- the format of the literal data that will be written to the output stream (one
of TEXT
or UTF8
).name
- the name of the "file" to encode in the literal data object.modificationTime
- the time of last modification we want stored.public java.io.OutputStream open(java.io.OutputStream out, char format, java.lang.String name, java.util.Date modificationTime, java.io.File backingFile) 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 underlying output stream to write the literal data packet to.format
- the format of the literal data that will be written to the output stream (one
of TEXT
or UTF8
).name
- the name of the "file" to encode in the literal data object.modificationTime
- the time of last modification we want stored.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 underlying output stream to write the literal data packet to.format
- the format of the literal data that will be written to the output stream (one
of TEXT
or UTF8
).name
- the name of the "file" to encode in the literal data object.modificationTime
- the time of last modification we want stored (will be stored to
second level precision).buffer
- a buffer to use to buffer and write partial packets. The returned stream takes
ownership of the buffer.public java.io.OutputStream open(java.io.OutputStream out, char format, java.io.File file) throws java.io.IOException
This method configures the generator to store the file contents in a single literal data packet, taking the filename and modification time from the file, but does not store the actual file data.
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 underlying output stream to write the literal data packet to.format
- the format of the literal data that will be written to the output stream (one
of TEXT
or UTF8
).file
- the file to determine the filename from.public void close() throws java.io.IOException
|
Bouncy Castle Cryptography 1.71 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |