TrueZIP 6.8.3

de.schlichtherle.io.archive.zip
Class CheckedJarInputArchive

java.lang.Object
  extended by de.schlichtherle.util.zip.BasicZipFile
      extended by de.schlichtherle.io.archive.zip.ZipInputArchive
          extended by de.schlichtherle.io.archive.zip.JarInputArchive
              extended by de.schlichtherle.io.archive.zip.CheckedJarInputArchive
All Implemented Interfaces:
InputArchive

public class CheckedJarInputArchive
extends JarInputArchive

A JarInputArchive which checks the CRC-32 value for all JAR entries. The additional CRC-32 computation makes this class slower than its super class.

If there is a mismatch of the CRC-32 values for a JAR entry in an input archive, the InputStream.close() method of the corresponding stream for the archive entry will throw a CRC32Exception. This exception is then propagated through the stack up to the corresponding file operation in the package de.schlichtherle.io where it is either allowed to pass on or is catched and processed accordingly. For example, the FilterInputStream.close() method would allow the CRC32Exception to pass on to the client application, whereas the File.catTo(OutputStream) method would simply return false. Other than this, the archive entry will be processed normally. So if just the CRC-32 value for the entry in the archive file has been modified, you can still read its entire contents.

Since:
TrueZIP 6.7
Author:
Christian Schlichtherle
See Also:
JarInputArchive, CheckedJarDriver

Field Summary
 
Fields inherited from class de.schlichtherle.util.zip.BasicZipFile
DEFAULT_CHARSET
 
Constructor Summary
CheckedJarInputArchive(ReadOnlyFile rof, String charset, boolean preambled, boolean postambled)
           
 
Method Summary
 InputStream getInputStream(ArchiveEntry entry, ArchiveEntry dstEntry)
          Overridden to read from a checked input stream.
 
Methods inherited from class de.schlichtherle.io.archive.zip.JarInputArchive
createZipEntry
 
Methods inherited from class de.schlichtherle.io.archive.zip.ZipInputArchive
getArchiveEntries, getArchiveEntry, getMetaData, getNumArchiveEntries, setMetaData
 
Methods inherited from class de.schlichtherle.util.zip.BasicZipFile
busy, close, createReadOnlyFile, entries, getCharset, getCheckedInputStream, getCheckedInputStream, getComment, getEntry, getInputStream, getInputStream, getInputStream, getInputStream, getInputStream, getPostambleInputStream, getPostambleLength, getPreambleInputStream, getPreambleLength, length, offsetsConsiderPreamble, size
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.schlichtherle.io.archive.spi.InputArchive
close
 

Constructor Detail

CheckedJarInputArchive

public CheckedJarInputArchive(ReadOnlyFile rof,
                              String charset,
                              boolean preambled,
                              boolean postambled)
                       throws NullPointerException,
                              UnsupportedEncodingException,
                              FileNotFoundException,
                              ZipException,
                              IOException
Throws:
NullPointerException
UnsupportedEncodingException
FileNotFoundException
ZipException
IOException
Method Detail

getInputStream

public InputStream getInputStream(ArchiveEntry entry,
                                  ArchiveEntry dstEntry)
                           throws IOException
Overridden to read from a checked input stream.

Specified by:
getInputStream in interface InputArchive
Overrides:
getInputStream in class ZipInputArchive
Parameters:
entry - A valid reference to an archive entry. The runtime class of this entry is the same as the runtime class of the entries returned by InputArchive.getArchiveEntries().
dstEntry - If not null, this identifies the entry to which TrueZIP is actually copying data to and should be used to implement the Direct Data Copying (DDC) feature. Note that there is no guarantee on the runtime type of this object; it may have been created by other drivers.

For example, the ZIP driver family uses this to determine if data should be provided in its deflated form if the destination entry is another ZIP file entry.

Returns:
A (preferrably unbuffered) InputStream to read the archive entry data from. null is not allowed!
Throws:
InputArchiveBusyException - If the archive is currently busy on input for another entry. This exception is guaranteed to be recoverable, meaning it should be possible to read the same entry again as soon as the archive is not busy on input anymore.
FileNotFoundException - If the archive entry does not exist or is not accessible for some reason.
IOException - On any other exceptional condition.

TrueZIP 6.8.3

Copyright © 2005-2011 Schlichtherle IT Services. All Rights Reserved.