de.schlichtherle.io.archive.zip
Class CheckedZipInputArchive
java.lang.Object
de.schlichtherle.util.zip.BasicZipFile
de.schlichtherle.io.archive.zip.ZipInputArchive
de.schlichtherle.io.archive.zip.CheckedZipInputArchive
- All Implemented Interfaces:
- InputArchive
- Direct Known Subclasses:
- CheckedZip32InputArchive
public class CheckedZipInputArchive
- extends ZipInputArchive
A ZipInputArchive which checks the CRC-32 value for all ZIP 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 ZIP 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.1
- Author:
- Christian Schlichtherle
- See Also:
ZipInputArchive,
CheckedZipDriver
| 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 |
CheckedZipInputArchive
public CheckedZipInputArchive(ReadOnlyFile rof,
String charset,
boolean preambled,
boolean postambled)
throws NullPointerException,
UnsupportedEncodingException,
FileNotFoundException,
ZipException,
IOException
- Throws:
NullPointerException
UnsupportedEncodingException
FileNotFoundException
ZipException
IOException
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.
Copyright © 2005-2011 Schlichtherle IT Services. All Rights Reserved.