Merge "Make ArchiveFormats final and implement equals()"

This commit is contained in:
Dave Borowitz 2014-04-14 16:41:44 -04:00 committed by Gerrit Code Review @ Eclipse.org
commit 257546a08e
5 changed files with 55 additions and 5 deletions

View File

@ -61,7 +61,7 @@
/**
* Unix TAR format (ustar + some PAX extensions).
*/
public class TarFormat implements ArchiveCommand.Format<ArchiveOutputStream> {
public final class TarFormat implements ArchiveCommand.Format<ArchiveOutputStream> {
private static final List<String> SUFFIXES = Collections
.unmodifiableList(Arrays.asList(".tar")); //$NON-NLS-1$
@ -118,4 +118,14 @@ public void putEntry(ArchiveOutputStream out,
public Iterable<String> suffixes() {
return SUFFIXES;
}
@Override
public boolean equals(Object other) {
return (other instanceof TarFormat);
}
@Override
public int hashCode() {
return getClass().hashCode();
}
}

View File

@ -57,7 +57,7 @@
/**
* bzip2-compressed tarball (tar.bz2) format.
*/
public class Tbz2Format implements ArchiveCommand.Format<ArchiveOutputStream> {
public final class Tbz2Format implements ArchiveCommand.Format<ArchiveOutputStream> {
private static final List<String> SUFFIXES = Collections
.unmodifiableList(Arrays.asList(".tar.bz2", ".tbz", ".tbz2")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
@ -78,4 +78,14 @@ public void putEntry(ArchiveOutputStream out,
public Iterable<String> suffixes() {
return SUFFIXES;
}
@Override
public boolean equals(Object other) {
return (other instanceof Tbz2Format);
}
@Override
public int hashCode() {
return getClass().hashCode();
}
}

View File

@ -57,7 +57,7 @@
/**
* gzip-compressed tarball (tar.gz) format.
*/
public class TgzFormat implements ArchiveCommand.Format<ArchiveOutputStream> {
public final class TgzFormat implements ArchiveCommand.Format<ArchiveOutputStream> {
private static final List<String> SUFFIXES = Collections
.unmodifiableList(Arrays.asList(".tar.gz", ".tgz")); //$NON-NLS-1$ //$NON-NLS-2$
@ -78,4 +78,14 @@ public void putEntry(ArchiveOutputStream out,
public Iterable<String> suffixes() {
return SUFFIXES;
}
@Override
public boolean equals(Object other) {
return (other instanceof TgzFormat);
}
@Override
public int hashCode() {
return getClass().hashCode();
}
}

View File

@ -57,7 +57,7 @@
/**
* Xz-compressed tar (tar.xz) format.
*/
public class TxzFormat implements ArchiveCommand.Format<ArchiveOutputStream> {
public final class TxzFormat implements ArchiveCommand.Format<ArchiveOutputStream> {
private static final List<String> SUFFIXES = Collections
.unmodifiableList(Arrays.asList(".tar.xz", ".txz")); //$NON-NLS-1$ //$NON-NLS-2$
@ -78,4 +78,14 @@ public void putEntry(ArchiveOutputStream out,
public Iterable<String> suffixes() {
return SUFFIXES;
}
@Override
public boolean equals(Object other) {
return (other instanceof TxzFormat);
}
@Override
public int hashCode() {
return getClass().hashCode();
}
}

View File

@ -60,7 +60,7 @@
/**
* PKWARE's ZIP format.
*/
public class ZipFormat implements ArchiveCommand.Format<ArchiveOutputStream> {
public final class ZipFormat implements ArchiveCommand.Format<ArchiveOutputStream> {
private static final List<String> SUFFIXES = Collections
.unmodifiableList(Arrays.asList(".zip")); //$NON-NLS-1$
@ -105,4 +105,14 @@ public void putEntry(ArchiveOutputStream out,
public Iterable<String> suffixes() {
return SUFFIXES;
}
@Override
public boolean equals(Object other) {
return (other instanceof ZipFormat);
}
@Override
public int hashCode() {
return getClass().hashCode();
}
}