jarify
Class JarFile

java.lang.Object
  extended by jarify.JarFile

final class JarFile
extends java.lang.Object

This class warps a jar file.
It provides methods for reading the files containing in the jar file.


Field Summary
private  java.lang.String m_FileName
          the path of the jar file in case of remote files, it is the path for the local, temporary file
private  JarManifest m_Manifest
          the manifest related to this jar file
private  java.util.zip.ZipFile m_ZipFile
          the jar file
 
Constructor Summary
JarFile(java.io.File file)
          Constructor If an exception occurs, the jar file could not be opened and read.
 
Method Summary
 boolean close()
          Close the jar file.
 boolean fileExists(java.lang.String name)
          Test if a file entry exists in the jar archive.
 java.util.Vector getAliasList()
           
 JarFileEntry getFileByName(java.lang.String name)
          Returns the JarFileEntry for the file with the given name.
 JarManifest getManifest()
          Returns the mainfest.
 java.lang.String getName()
          Returns the fully qualified name of the jar file.
 JarFileEntry getSignatureBlockFile(java.lang.String alias)
          Returns the signature block file that maps to the given name
 java.util.Vector getSignatureBlockFiles(java.lang.String alias)
          Returns the signature block files that maps to the given name
 JarSignatureFile getSignatureFile(java.lang.String alias)
          Returns the signature file with the given alias.
private  void init()
          Opens the jar file and read the manifest.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_FileName

private java.lang.String m_FileName
the path of the jar file in case of remote files, it is the path for the local, temporary file


m_ZipFile

private java.util.zip.ZipFile m_ZipFile
the jar file


m_Manifest

private JarManifest m_Manifest
the manifest related to this jar file

Constructor Detail

JarFile

public JarFile(java.io.File file)
        throws java.util.zip.ZipException,
               java.io.IOException,
               java.lang.SecurityException
Constructor If an exception occurs, the jar file could not be opened and read.

Parameters:
name - the path of the jar file
Throws:
java.util.zip.ZipException
java.io.IOException
java.lang.SecurityException
Method Detail

init

private void init()
           throws java.io.IOException
Opens the jar file and read the manifest.

Throws:
java.io.IOException - if jar file could not be read

getManifest

public JarManifest getManifest()
Returns the mainfest.

Returns:
the mainfest

fileExists

public boolean fileExists(java.lang.String name)
Test if a file entry exists in the jar archive.

Parameters:
name - the name of the file entry
Returns:
true, if it exists

getSignatureFile

public JarSignatureFile getSignatureFile(java.lang.String alias)
Returns the signature file with the given alias. Note: alias is case sensitive

Parameters:
alias - the alias of the signature file
Returns:
the signature file or null if no signature file with the given alias was found

getSignatureBlockFile

public JarFileEntry getSignatureBlockFile(java.lang.String alias)
Returns the signature block file that maps to the given name

Parameters:
alias - the alias of the signature block file
Returns:
the signature block file that maps to the given name

getSignatureBlockFiles

public java.util.Vector getSignatureBlockFiles(java.lang.String alias)
Returns the signature block files that maps to the given name

Parameters:
alias - the alias of the signature block file
Returns:
the signature block files that maps to the given name

getFileByName

public JarFileEntry getFileByName(java.lang.String name)
Returns the JarFileEntry for the file with the given name.
The name has to be realtiv to jar file and has to be a filename included in the jar file. The name can be a URL

Parameters:
name - the name of the file relative to jar file
Returns:
the JarFileEntry for the given file name or null if not found

getName

public java.lang.String getName()
Returns the fully qualified name of the jar file.

Returns:
the fully qualified name of the jar file

getAliasList

public java.util.Vector getAliasList()
Returns:
the alias' of all signatures this jar file was signed with

close

public boolean close()
Close the jar file.

Returns:
true is close was succesfull, false else