1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2024-11-30 08:12:06 +01:00

Remove OpenPgpMetadata.FileInfo subclass

This commit is contained in:
Paul Schaub 2021-08-15 15:30:09 +02:00
parent 2bd71617bd
commit 5eb470862e
2 changed files with 0 additions and 92 deletions

View file

@ -156,21 +156,6 @@ public class OpenPgpMetadata {
} }
} }
/**
* Return information about the encrypted/signed file.
*
* @deprecated use {@link #getFileName()}, {@link #getModificationDate()} and {@link #getFileEncoding()} instead.
* @return file info
*/
@Deprecated
public FileInfo getFileInfo() {
return new FileInfo(
getFileName(),
getModificationDate(),
getFileEncoding()
);
}
/** /**
* Return the name of the encrypted / signed file. * Return the name of the encrypted / signed file.
* *
@ -207,73 +192,6 @@ public class OpenPgpMetadata {
return fileEncoding; return fileEncoding;
} }
@Deprecated
public static class FileInfo {
protected final String fileName;
protected final Date modificationDate;
protected final StreamEncoding streamEncoding;
public FileInfo(String fileName, Date modificationDate, StreamEncoding streamEncoding) {
this.fileName = fileName == null ? "" : fileName;
this.modificationDate = modificationDate == null ? PGPLiteralData.NOW : modificationDate;
this.streamEncoding = streamEncoding;
}
public String getFileName() {
return fileName;
}
public Date getModificationDate() {
return modificationDate;
}
public StreamEncoding getStreamFormat() {
return streamEncoding;
}
@Override
public boolean equals(Object other) {
if (other == null) {
return false;
}
if (this == other) {
return true;
}
if (!(other instanceof FileInfo)) {
return false;
}
FileInfo o = (FileInfo) other;
if (getFileName() != null) {
if (!getFileName().equals(o.getFileName())) {
return false;
}
} else {
if (o.getFileName() != null) {
return false;
}
}
if (getModificationDate() != null) {
if (o.getModificationDate() == null) {
return false;
}
long diff = Math.abs(getModificationDate().getTime() - o.getModificationDate().getTime());
if (diff > 1000) {
return false;
}
} else {
if (o.getModificationDate() != null) {
return false;
}
}
return getStreamFormat() == o.getStreamFormat();
}
}
public static Builder getBuilder() { public static Builder getBuilder() {
return new Builder(); return new Builder();
} }

View file

@ -19,7 +19,6 @@ import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import org.bouncycastle.openpgp.PGPLiteralData; import org.bouncycastle.openpgp.PGPLiteralData;
@ -27,7 +26,6 @@ import org.bouncycastle.openpgp.PGPSignature;
import org.pgpainless.algorithm.CompressionAlgorithm; import org.pgpainless.algorithm.CompressionAlgorithm;
import org.pgpainless.algorithm.StreamEncoding; import org.pgpainless.algorithm.StreamEncoding;
import org.pgpainless.algorithm.SymmetricKeyAlgorithm; import org.pgpainless.algorithm.SymmetricKeyAlgorithm;
import org.pgpainless.decryption_verification.OpenPgpMetadata;
import org.pgpainless.key.SubkeyIdentifier; import org.pgpainless.key.SubkeyIdentifier;
import org.pgpainless.util.MultiMap; import org.pgpainless.util.MultiMap;
@ -80,16 +78,8 @@ public final class EncryptionResult {
} }
/** /**
* Return information about the encrypted / signed data.
* *
* @deprecated use {@link #getFileName()}, {@link #getModificationDate()} and {@link #getFileEncoding()} instead.
* @return info
*/ */
@Deprecated
public OpenPgpMetadata.FileInfo getFileInfo() {
return new OpenPgpMetadata.FileInfo(getFileName(), getModificationDate(), getFileEncoding());
}
public String getFileName() { public String getFileName() {
return fileName; return fileName;
} }