diff options
Diffstat (limited to 'libraries/spongycastle/pg/src/main/java/org/spongycastle/openpgp/PGPLiteralData.java')
-rw-r--r-- | libraries/spongycastle/pg/src/main/java/org/spongycastle/openpgp/PGPLiteralData.java | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/libraries/spongycastle/pg/src/main/java/org/spongycastle/openpgp/PGPLiteralData.java b/libraries/spongycastle/pg/src/main/java/org/spongycastle/openpgp/PGPLiteralData.java new file mode 100644 index 000000000..e6ac1bc62 --- /dev/null +++ b/libraries/spongycastle/pg/src/main/java/org/spongycastle/openpgp/PGPLiteralData.java @@ -0,0 +1,96 @@ +package org.spongycastle.openpgp; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Date; + +import org.spongycastle.bcpg.BCPGInputStream; +import org.spongycastle.bcpg.LiteralDataPacket; + +/** + * class for processing literal data objects. + */ +public class PGPLiteralData +{ + public static final char BINARY = 'b'; + public static final char TEXT = 't'; + public static final char UTF8 = 'u'; + + /** + * The special name indicating a "for your eyes only" packet. + */ + public static final String CONSOLE = "_CONSOLE"; + + /** + * The special time for a modification time of "now" or + * the present time. + */ + public static final Date NOW = new Date(0L); + + LiteralDataPacket data; + + public PGPLiteralData( + BCPGInputStream pIn) + throws IOException + { + data = (LiteralDataPacket)pIn.readPacket(); + } + + /** + * Return the format of the data stream - BINARY or TEXT. + * + * @return int + */ + public int getFormat() + { + return data.getFormat(); + } + + /** + * Return the file name that's associated with the data stream. + * + * @return String + */ + public String getFileName() + { + return data.getFileName(); + } + + /** + * Return the file name as an unintrepreted byte array. + */ + public byte[] getRawFileName() + { + return data.getRawFileName(); + } + + /** + * Return the modification time for the file. + * + * @return the modification time. + */ + public Date getModificationTime() + { + return new Date(data.getModificationTime()); + } + + /** + * Return the raw input stream for the data stream. + * + * @return InputStream + */ + public InputStream getInputStream() + { + return data.getInputStream(); + } + + /** + * Return the input stream representing the data stream + * + * @return InputStream + */ + public InputStream getDataStream() + { + return this.getInputStream(); + } +} |