org.bouncycastle.bcpg.LiteralDataPacket Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bcpg-jdk15 Show documentation
Show all versions of bcpg-jdk15 Show documentation
The Bouncy Castle Java API for handling the OpenPGP protocol. This jar contains the OpenPGP API for JDK 1.5. The APIs can be used in conjunction with a JCE/JCA provider such as the one provided with the Bouncy Castle Cryptography APIs.
package org.bouncycastle.bcpg;
import java.io.*;
/**
* generic literal data packet.
*/
public class LiteralDataPacket
extends InputStreamPacket
{
int format;
char[] fileName;
long modDate;
LiteralDataPacket(
BCPGInputStream in)
throws IOException
{
super(in);
format = in.read();
int l = in.read();
fileName = new char[l];
for (int i = 0; i != fileName.length; i++)
{
fileName[i] = (char)in.read();
}
modDate = ((long)in.read() << 24) | (in.read() << 16) | (in.read() << 8) | in.read();
}
/**
* return the format tag value.
*
* @return format tag value.
*/
public int getFormat()
{
return format;
}
/**
* Return the modification time of the file in milli-seconds.
*
* @return the modification time in millis
*/
public long getModificationTime()
{
return modDate * 1000L;
}
/**
* @return filename
*/
public String getFileName()
{
return new String(fileName);
}
public byte[] getRawFileName()
{
byte[] tmp = new byte[fileName.length];
for (int i = 0; i != tmp.length; i++)
{
tmp[i] = (byte)fileName[i];
}
return tmp;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy