01: package org.bouncycastle.bcpg;
02:
03: import java.io.*;
04:
05: /**
06: * generic literal data packet.
07: */
08: public class LiteralDataPacket extends InputStreamPacket {
09: int format;
10: char[] fileName;
11: long modDate;
12:
13: LiteralDataPacket(BCPGInputStream in) throws IOException {
14: super (in);
15:
16: format = in.read();
17: int l = in.read();
18:
19: fileName = new char[l];
20: for (int i = 0; i != fileName.length; i++) {
21: fileName[i] = (char) in.read();
22: }
23:
24: modDate = ((long) in.read() << 24) | (in.read() << 16)
25: | (in.read() << 8) | in.read();
26: }
27:
28: /**
29: * return the format tag value.
30: *
31: * @return format tag value.
32: */
33: public int getFormat() {
34: return format;
35: }
36:
37: /**
38: * Return the modification time of the file in milli-seconds.
39: *
40: * @return the modification time in millis
41: */
42: public long getModificationTime() {
43: return modDate * 1000L;
44: }
45:
46: /**
47: * @return filename
48: */
49: public String getFileName() {
50: return new String(fileName);
51: }
52: }
|