org.jarpatch
Class JarContent

java.lang.Object
  extended by org.jarpatch.JarContent

public class JarContent
extends java.lang.Object

maintain a view of a Jar content. Read a jar file, and compute a MD5 key for each file entry of the jar file

Version:
$Revision$
Author:
Norbert Barbosa

Constructor Summary
JarContent(java.io.File jar)
          build a new JarContent from the given jar file
 
Method Summary
 java.util.List computeDeletedEntry(JarContent newJar)
           
 java.util.jar.JarEntry[] computeNewerEntry(JarContent oldJar)
          return all the JarEntry that have been modified from the old jar, or EMPTY_JARENTRY.
 java.io.File extractJarEntry(java.lang.String entry)
          Extracts a jar or zip entry to a temp file which can be used for additional comparison
 int getNumberOfJarEntries()
          Return the number of entries within a jar file
 void initializeContent()
          initialize the JarContent from the jar
 void setExcludePattern(java.util.regex.Pattern[] excludes)
          set the exclude pattern
 void writeEntry(java.util.jar.JarEntry jarEntry, java.io.OutputStream out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JarContent

public JarContent(java.io.File jar)
           throws java.io.IOException
build a new JarContent from the given jar file

Throws:
java.io.IOException
Method Detail

setExcludePattern

public void setExcludePattern(java.util.regex.Pattern[] excludes)
set the exclude pattern


initializeContent

public void initializeContent()
                       throws java.io.IOException
initialize the JarContent from the jar

Throws:
java.io.IOException

extractJarEntry

public java.io.File extractJarEntry(java.lang.String entry)
                             throws java.io.IOException
Extracts a jar or zip entry to a temp file which can be used for additional comparison

Parameters:
entry - the jar, zip, or war entry
Returns:
the temp file of the extracted file
Throws:
java.io.IOException - if an error occurs during the extraction

getNumberOfJarEntries

public int getNumberOfJarEntries()
Return the number of entries within a jar file

Returns:
the number of entries

computeNewerEntry

public java.util.jar.JarEntry[] computeNewerEntry(JarContent oldJar)
                                           throws java.io.IOException
return all the JarEntry that have been modified from the old jar, or EMPTY_JARENTRY.

Throws:
java.io.IOException

computeDeletedEntry

public java.util.List computeDeletedEntry(JarContent newJar)
                                   throws java.io.IOException
Throws:
java.io.IOException

writeEntry

public void writeEntry(java.util.jar.JarEntry jarEntry,
                       java.io.OutputStream out)
                throws java.io.IOException
Throws:
java.io.IOException


Copyright © 2004 Norbert Barbosa?t - norbert.barbosa@laposte.com - All rights reserved.