|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object zipdiff.DifferenceCalculator
Checks and compiles differences between two zip files. It also has the ability to exclude entries from the comparison based on a regular expression.
Constructor Summary | |
DifferenceCalculator(java.io.File f1,
java.io.File f2)
Constructor taking 2 Files to compare |
|
DifferenceCalculator(java.lang.String filename1,
java.lang.String filename2)
Constructor taking 2 filenames to compare |
|
DifferenceCalculator(java.util.zip.ZipFile zf1,
java.util.zip.ZipFile zf2)
Constructor taking 2 ZipFiles to compare |
Method Summary | |
protected java.util.Map |
buildZipEntryMap(java.util.zip.ZipFile zf)
Opens the ZipFile and builds up a map of all the entries. |
protected Differences |
calculateDifferences(java.util.Map m1,
java.util.Map m2)
Given two Maps of ZipEntries it will generate a Differences of all the differences found between the two maps. |
protected Differences |
calculateDifferences(java.util.zip.ZipFile zf1,
java.util.zip.ZipFile zf2)
Calculates all the differences between two zip files. |
protected void |
debug(java.lang.Object msg)
|
protected boolean |
entriesMatch(java.util.zip.ZipEntry entry1,
java.util.zip.ZipEntry entry2)
returns true if the two entries are equivalent in type, name, size, compressed size and time or CRC. |
boolean |
getCompareCRCValues()
|
Differences |
getDifferences()
|
boolean |
ignoreCVSFiles()
|
protected boolean |
ignoreThisFile(java.lang.String filepath,
java.lang.String entryName)
returns true if fileToIgnorePattern matches the filename given. |
protected boolean |
isCVSFile(java.lang.String filepath,
java.lang.String entryName)
|
boolean |
isIgnoringTimestamps()
|
protected boolean |
isVerboseEnabled()
|
static boolean |
isZipFile(java.lang.String filename)
Returns true if the filename has a valid zip extension. |
protected void |
processEmbeddedZipFile(java.lang.String prefix,
java.io.InputStream is,
java.util.Map m)
|
protected void |
processZipEntry(java.lang.String prefix,
java.util.zip.ZipEntry zipEntry,
java.io.InputStream is,
java.util.Map zipEntryMap)
Will place ZipEntries for a given ZipEntry into the given Map. |
void |
setCompareCRCValues(boolean b)
Ensure that the comparison checks against the CRCs of the entries. |
void |
setFilenameRegexToIgnore(java.util.Set patterns)
|
void |
setIgnoreCVSFiles(boolean b)
|
void |
setIgnoreTimestamps(boolean b)
|
void |
setVerbose(boolean b)
Set the verboseness of the debug output. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DifferenceCalculator(java.lang.String filename1, java.lang.String filename2) throws java.io.IOException
java.io.IOException
public DifferenceCalculator(java.io.File f1, java.io.File f2) throws java.io.IOException
java.io.IOException
public DifferenceCalculator(java.util.zip.ZipFile zf1, java.util.zip.ZipFile zf2)
Method Detail |
protected void debug(java.lang.Object msg)
public void setVerbose(boolean b)
b
- true to make verboseprotected boolean isVerboseEnabled()
public void setFilenameRegexToIgnore(java.util.Set patterns)
java.util.regex
protected boolean ignoreThisFile(java.lang.String filepath, java.lang.String entryName)
filepath
-
protected boolean isCVSFile(java.lang.String filepath, java.lang.String entryName)
public void setCompareCRCValues(boolean b)
b
- true ensures that CRCs will be checkedpublic boolean getCompareCRCValues()
protected java.util.Map buildZipEntryMap(java.util.zip.ZipFile zf) throws java.io.IOException
zf
- The ZipFile for which to build up the map of ZipEntries
java.io.IOException
protected void processZipEntry(java.lang.String prefix, java.util.zip.ZipEntry zipEntry, java.io.InputStream is, java.util.Map zipEntryMap) throws java.io.IOException
prefix
- The prefix of the ZipEntry that should be added to the key. Typically used
when processing embedded ZipFiles. The name of the embedded ZipFile would be the prefix of
all the embedded ZipEntries.zipEntry
- The ZipEntry to place into the Map. If it is a ZipFile then all its ZipEntries
will also be placed in the Map.is
- The InputStream of the corresponding ZipEntry.zipEntryMap
- The Map in which to place all the ZipEntries into. The key will
be the name of the ZipEntry.
java.io.IOException
protected void processEmbeddedZipFile(java.lang.String prefix, java.io.InputStream is, java.util.Map m) throws java.io.IOException
java.io.IOException
public static boolean isZipFile(java.lang.String filename)
filename
- The name of the file to check.
protected Differences calculateDifferences(java.util.zip.ZipFile zf1, java.util.zip.ZipFile zf2) throws java.io.IOException
zf1
- The first ZipFile to comparezf2
- The second ZipFile to compare
java.io.IOException
protected Differences calculateDifferences(java.util.Map m1, java.util.Map m2)
protected boolean entriesMatch(java.util.zip.ZipEntry entry1, java.util.zip.ZipEntry entry2)
entry1
- The first ZipEntry to compareentry2
- The second ZipEntry to compare
public void setIgnoreTimestamps(boolean b)
public boolean isIgnoringTimestamps()
public boolean ignoreCVSFiles()
public void setIgnoreCVSFiles(boolean b)
public Differences getDifferences() throws java.io.IOException
java.io.IOException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |