Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

cryptix.openpgp.packet
Class PGPLiteralDataPacket  view PGPLiteralDataPacket download PGPLiteralDataPacket.java

java.lang.Object
  extended bycryptix.openpgp.packet.PGPPacket
      extended bycryptix.openpgp.packet.PGPLiteralDataPacket

public class PGPLiteralDataPacket
extends PGPPacket

I'm currently implementing this class

Version:
$Revision: 1.3 $

Field Summary
private  boolean binary
           
private  byte[] data
           
private  java.lang.String filename
           
private  boolean local
           
private  long time
           
 
Fields inherited from class cryptix.openpgp.packet.PGPPacket
 
Constructor Summary
PGPLiteralDataPacket()
          Empty constructor.
 
Method Summary
 void decodeBody(cryptix.openpgp.io.PGPPacketDataInputStream in, cryptix.openpgp.algorithm.PGPAlgorithmFactory factory)
          Read the packet body.
 void encodeBody(cryptix.openpgp.io.PGPPacketDataOutputStream out)
          Encode the packet body.
 boolean equals(java.lang.Object ssp)
          Compare this packet to another one.
 byte[] getBinaryData()
          Get the binary payload of this packet.
 java.lang.String getFileName()
          Get the filename for the data in this packet.
 java.lang.String getTextData()
          Get the text payload of this packet.
 long getTime()
          Get the time.
 boolean isBinary()
          Returns true if the contained data is in binary format
 boolean isLocal()
          Returns true if the contained data is in local format
 boolean isText()
          Returns true if the contained data is in text format
 void setData(byte[] data)
          Set a binary payload for this packet.
 void setData(java.lang.String data)
          Set a text payload of this packet.
 void setFileName(java.lang.String filename)
          Set the filename for the data in this packet.
 void setTime(long time)
          Set the time.
 
Methods inherited from class cryptix.openpgp.packet.PGPPacket
encode, getForceLengthType, getPacketID, hashCode, isLazy, setPacketID
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

data

private byte[] data

filename

private java.lang.String filename

binary

private boolean binary

local

private boolean local

time

private long time
Constructor Detail

PGPLiteralDataPacket

public PGPLiteralDataPacket()
Empty constructor.

Remember to use setPacketID to set the packet ID.

Method Detail

setData

public void setData(byte[] data)
Set a binary payload for this packet.


setData

public void setData(java.lang.String data)
Set a text payload of this packet.


getBinaryData

public byte[] getBinaryData()
Get the binary payload of this packet.

If text data is present, then this method will convert it to binary data. (using UTF-8 encoding)


getTextData

public java.lang.String getTextData()
Get the text payload of this packet.

If binary data is present, then this method will convert it to a String. (using UTF-8 encoding)


setTime

public void setTime(long time)
Set the time.

The time is one of the following:
- the last time the file was modified
- the time the packet was created
- or zero to indicate the current time


getTime

public long getTime()
Get the time.

The time is one of the following:
- the last time the file was modified
- the time the packet was created
- or zero to indicate the current time


setFileName

public void setFileName(java.lang.String filename)
Set the filename for the data in this packet.


getFileName

public java.lang.String getFileName()
Get the filename for the data in this packet.


isBinary

public boolean isBinary()
Returns true if the contained data is in binary format

Note that this method also returns true for local format data.


isText

public boolean isText()
Returns true if the contained data is in text format


isLocal

public boolean isLocal()
Returns true if the contained data is in local format

This format is a deprecated format, that is only specified in RFC1991 and thus probably only used by old (PGP 2) clients.

Note that if this method returns true, then isBinary also returns true.


equals

public boolean equals(java.lang.Object ssp)
Compare this packet to another one.

Specified by:
equals in class PGPPacket

decodeBody

public void decodeBody(cryptix.openpgp.io.PGPPacketDataInputStream in,
                       cryptix.openpgp.algorithm.PGPAlgorithmFactory factory)
                throws java.io.IOException,
                       cryptix.openpgp.PGPFatalDataFormatException,
                       cryptix.openpgp.PGPDataFormatException
Read the packet body.

Specified by:
decodeBody in class PGPPacket

encodeBody

public void encodeBody(cryptix.openpgp.io.PGPPacketDataOutputStream out)
                throws java.io.IOException
Encode the packet body.

Specified by:
encodeBody in class PGPPacket