01: package org.bouncycastle.openpgp;
02:
03: import java.io.IOException;
04: import java.io.InputStream;
05: import java.util.Date;
06:
07: import org.bouncycastle.bcpg.BCPGInputStream;
08: import org.bouncycastle.bcpg.LiteralDataPacket;
09:
10: /**
11: * class for processing literal data objects.
12: */
13: public class PGPLiteralData {
14: public static final char BINARY = 'b';
15: public static final char TEXT = 't';
16:
17: /**
18: * The special name indicating a "for your eyes only" packet.
19: */
20: public static final String CONSOLE = "_CONSOLE";
21:
22: /**
23: * The special time for a modification time of "now" or
24: * the present time.
25: */
26: public static final Date NOW = new Date(0L);
27:
28: LiteralDataPacket data;
29:
30: public PGPLiteralData(BCPGInputStream pIn) throws IOException {
31: data = (LiteralDataPacket) pIn.readPacket();
32: }
33:
34: /**
35: * Return the format of the data stream - BINARY or TEXT.
36: *
37: * @return int
38: */
39: public int getFormat() {
40: return data.getFormat();
41: }
42:
43: /**
44: * Return the file name that's associated with the data stream.
45: *
46: * @return String
47: */
48: public String getFileName() {
49: return data.getFileName();
50: }
51:
52: /**
53: * Return the modification time for the file.
54: *
55: * @return the modification time.
56: */
57: public Date getModificationTime() {
58: return new Date(data.getModificationTime());
59: }
60:
61: /**
62: * Return the raw input stream for the data stream.
63: *
64: * @return InputStream
65: */
66: public InputStream getInputStream() {
67: return data.getInputStream();
68: }
69:
70: /**
71: * Return the input stream representing the data stream
72: *
73: * @return InputStream
74: */
75: public InputStream getDataStream() {
76: return this.getInputStream();
77: }
78: }
|