using System;
using System.IO;
using Org.BouncyCastle.Utilities.Date;
namespace Org.BouncyCastle.Bcpg.OpenPgp
{
/// Class for processing literal data objects.
public class PgpLiteralData
: PgpObject
{
public const char Binary = 'b';
public const char Text = 't';
public const char Utf8 = 'u';
/// The special name indicating a "for your eyes only" packet.
public const string Console = "_CONSOLE";
private LiteralDataPacket data;
public PgpLiteralData(
BcpgInputStream bcpgInput)
{
data = (LiteralDataPacket) bcpgInput.ReadPacket();
}
/// The format of the data stream - Binary or Text
public int Format
{
get { return data.Format; }
}
/// The file name that's associated with the data stream.
public string FileName
{
get { return data.FileName; }
}
/// Return the file name as an unintrepreted byte array.
public byte[] GetRawFileName()
{
return data.GetRawFileName();
}
/// The modification time for the file.
public DateTime ModificationTime
{
get { return DateTimeUtilities.UnixMsToDateTime(data.ModificationTime); }
}
/// The raw input stream for the data stream.
public Stream GetInputStream()
{
return data.GetInputStream();
}
/// The input stream representing the data stream.
public Stream GetDataStream()
{
return GetInputStream();
}
}
}