Package org.c02e.jpgpj
Class FileMetadata
java.lang.Object
org.c02e.jpgpj.FileMetadata
Optional PGP message metadata.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Format for line-ending normalization.static class
Signature found by decryptor. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final FileMetadata.Format
static final String
private FileMetadata.Format
private long
private long
private String
private final List
<FileMetadata.Signature> private final Ring
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a metadata object with default values.FileMetadata
(File file) Constructs a metadata object from a file.FileMetadata
(String name) Constructs a metadata object with the specified file name .FileMetadata
(String name, FileMetadata.Format format) Constructs a metadata object with the specified file name and line-ending format.FileMetadata
(String name, FileMetadata.Format format, long length, long lastModified) Constructs a metadata object with the specified file name, line-ending format, length in bytes, and modified date in ms since the epoch.FileMetadata
(Path file) Constructs a metadata object from a file.FileMetadata
(org.bouncycastle.openpgp.PGPLiteralData data) Constructs a metadata object from Bouncy Castle message data. -
Method Summary
Modifier and TypeMethodDescriptionboolean
long
long
getName()
Signatures found on the file, including unverified signatures.int
PGP code for the signature type appropriate for the line-ending format of the original file.Keys that signed the file with a verified signature.int
hashCode()
void
void
void
void
setLastModified
(long x) void
setLength
(long x) void
toString()
withLastModified
(long x) withLength
(long x)
-
Field Details
-
DEFAULT_NAME
- See Also:
-
DEFAULT_FORMAT
-
name
-
format
-
length
private long length -
lastModified
private long lastModified -
signatures
-
verified
-
-
Constructor Details
-
FileMetadata
public FileMetadata()Constructs a metadata object with default values. -
FileMetadata
public FileMetadata(org.bouncycastle.openpgp.PGPLiteralData data) Constructs a metadata object from Bouncy Castle message data. -
FileMetadata
Constructs a metadata object from a file. -
FileMetadata
Constructs a metadata object from a file. -
FileMetadata
Constructs a metadata object with the specified file name . -
FileMetadata
Constructs a metadata object with the specified file name and line-ending format. -
FileMetadata
Constructs a metadata object with the specified file name, line-ending format, length in bytes, and modified date in ms since the epoch.
-
-
Method Details
-
getName
- Returns:
- Original file name ("foo.txt"), or "".
-
setName
- Parameters:
x
- Original file name ("foo.txt") - set to "" ifnull
-
withName
- See Also:
-
getLength
public long getLength()- Returns:
- Original file length in bytes, or 0.
-
setLength
public void setLength(long x) - Parameters:
x
- Original file length in bytes, or 0.
-
withLength
- See Also:
-
getLastModified
public long getLastModified()- Returns:
- Original file modified date in ms since epoch, or 0.
-
setLastModified
public void setLastModified(long x) - Parameters:
x
- Original file modified date in ms since epoch, or 0.
-
withLastModified
- See Also:
-
getLastModifiedDate
- Returns:
- Original file modified date, or date of the epoch.
- See Also:
-
getFormat
- Returns:
- Original file format, or binary.
-
setFormat
- Parameters:
x
- Original file format, orDEFAULT_FORMAT
ifnull
.
-
withFormat
- See Also:
-
getVerified
Keys that signed the file with a verified signature. If a specific userid was included in a key's signature (such as "Alice <alice@example.com>"), it will be available via the key'sKey.getSigningUid()
method. -
getSignatures
Signatures found on the file, including unverified signatures. -
setFile
- Parameters:
file
- OriginalFile
from which to extract the metadata - ignored ifnull
Does not extractFileMetadata.Format
metadata.
-
setFile
- Parameters:
file
- OriginalPath
from which to extract the metadata - ignored ifnull
Does not extractFileMetadata.Format
metadata.
-
withFile
- See Also:
-
withFile
- See Also:
-
getSignatureType
public int getSignatureType()PGP code for the signature type appropriate for the line-ending format of the original file. -
hashCode
public int hashCode() -
equals
-
toString
-