Top Description Inners Fields Constructors Methods
org.apache.tools.zip

public Class ZipFile

extends Object
implements Closeable
Class Inheritance
All Implemented Interfaces
java.io.Closeable, java.lang.AutoCloseable
Static Imports
org.apache.tools.zip.ZipConstants.DWORD, .ZipConstants.SHORT, .ZipConstants.WORD, .ZipConstants.ZIP64_MAGIC, .ZipConstants.ZIP64_MAGIC_SHORT

Replacement for java.util.ZipFile.

This class adds support for file name encodings other than UTF-8 (which is required to work on ZIP files created by native zip tools and is able to skip a preamble like the one found in self extracting archives. Furthermore it returns instances of org.apache.tools.zip.ZipEntry instead of java.util.zip.ZipEntry.

It doesn't extend java.util.zip.ZipFile as it would have to reimplement all methods anyway. Like java.util.ZipFile, it uses RandomAccessFile under the covers and supports compressed and uncompressed entries. As of Apache Ant 1.9.0 it also transparently supports Zip64 extensions and thus individual entries and archives larger than 4 GB or with more than 65536 entries.

The method signatures mimic the ones of java.util.zip.ZipFile, with a couple of exceptions:

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
ZipFile.BoundedInputStream

InputStream that delegates requests to the underlying RandomAccessFile, making sure that only bytes from a certain range can be read.

private static class
ZipFile.Entry

Extends ZipEntry to store the offset within the archive.

private static class
private static class

Field Summary

Modifier and TypeField and Description
private final RandomAccessFile
archive

The actual data source.

private final String
archiveName

File name of actual source.

pack-priv static final int
private static final int
CFD_LOCATOR_OFFSET

Offset of the field that holds the location of the first central directory entry inside the "End of central directory record" relative to the start of the "End of central directory record".

private final byte[]
private static final int
CFH_LEN

Length of a "central directory" entry structure without file name, extra fields or comment.

private static final long
private volatile boolean
closed

Whether the file is closed.

private final byte[]
private final String
encoding

The encoding to use for filenames and the file comment.

private final List<ZipEntry>
entries

List of entries in the order they appear inside the central directory.

private static final int
private static final long
LFH_OFFSET_FOR_FILENAME_LENGTH

Number of bytes in local file header up to the "length of filename" entry.

private static final int
MAX_EOCD_SIZE

Maximum length of the "End of central directory record" with a file comment.

private static final int
MIN_EOCD_SIZE

Length of the "End of central directory record" - which is supposed to be the last structure of the archive - without file comment.

private final Map<String, LinkedList<ZipEntry>>
nameMap

Maps String to list of ZipEntrys, name -> actual entries.

pack-priv static final int
private final Comparator<ZipEntry>
OFFSET_COMPARATOR

Compares two ZipEntries based on their offset within the archive.

private static final int
private static final int
private static final int
private static final int
private final byte[]
private final boolean
useUnicodeExtraFields

Whether to look for and use Unicode extra fields.

private final byte[]
private static final int
ZIP64_EOCD_CFD_LOCATOR_OFFSET

Offset of the field that holds the location of the first central directory entry inside the "Zip64 end of central directory record" relative to the start of the "Zip64 end of central directory record".

private static final int
ZIP64_EOCDL_LENGTH

Length of the "Zip64 end of central directory locator" - which should be right in front of the "end of central directory record" if one is present at all.

private static final int
ZIP64_EOCDL_LOCATOR_OFFSET

Offset of the field that holds the location of the "Zip64 end of central directory record" inside the "Zip64 end of central directory locator" relative to the start of the "Zip64 end of central directory locator".

private final ZipEncoding
zipEncoding

The zip encoding to use for filenames and the file comment.

Constructor Summary

AccessConstructor and Description
public
ZipFile(final File
the archive.
f
)

Opens the given file for reading, assuming the platform's native encoding for file names.

public
ZipFile(final String
name of the archive.
name
)

Opens the given file for reading, assuming the platform's native encoding for file names.

public
ZipFile(final String
name of the archive.
name
,
final String
the encoding to use for file names, use null for the platform's default encoding
encoding
)

Opens the given file for reading, assuming the specified encoding for file names, scanning unicode extra fields.

public
ZipFile(final File
the archive.
f
,
final String
the encoding to use for file names, use null for the platform's default encoding
encoding
)

Opens the given file for reading, assuming the specified encoding for file names and scanning for unicode extra fields.

public
ZipFile(final File
the archive.
f
,
final String
the encoding to use for file names, use null for the platform's default encoding
encoding
,
final boolean
whether to use InfoZIP Unicode Extra Fields (if present) to set the file names.
useUnicodeExtraFields
)

Opens the given file for reading, assuming the specified encoding for file names.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

boolean
canReadEntryData
(final ZipEntry
ZipEntry
ze
)

Whether this class is able to read the given entry.

public void
close()

Implements java.io.Closeable.close.

Closes the archive.
public static void
closeQuietly(final ZipFile
file to close, can be null
zipfile
)

close a zipfile quietly; throw no io fault, do nothing on a null parameter

protected void
finalize()

Overrides java.lang.Object.finalize.

Ensures that the close method of this zipfile is called when there are no more references to it.
public String

Returns:

null if using the platform's default character encoding.
getEncoding
()

The encoding to use for filenames and the file comment.

public Enumeration<ZipEntry>

Returns:

all entries as ZipEntry instances
getEntries
()

Returns all entries.

public Iterable<ZipEntry>

Returns:

the Iterable<ZipEntry> corresponding to the given name
getEntries
(final String
name of the entry.
name
)

Returns all named entries in the same order they appear within the archive's central directory.

public Enumeration<ZipEntry>

Returns:

all entries as ZipEntry instances
getEntriesInPhysicalOrder
()

Returns all entries in physical order.

public Iterable<ZipEntry>

Returns:

the Iterable<ZipEntry> corresponding to the given name
getEntriesInPhysicalOrder
(final String
name of the entry.
name
)

Returns all named entries in the same order their contents appear within the archive.

public ZipEntry

Returns:

the ZipEntry corresponding to the given name - or null if not present.
getEntry
(final String
name of the entry.
name
)

Returns a named entry - or null if no entry by that name exists.

public InputStream

Returns:

a stream to read the entry from.
getInputStream
(final ZipEntry
the entry to get the stream for.
ze
)

Returns an InputStream for reading the contents of the given entry.

public String
private Map<ZipEntry, ZipFile.NameAndComment>

Returns:

a map of zipentries that didn't have the language encoding flag set when read.
populateFromCentralDirectory
()

Reads the central directory of the given archive and populates the internal tables with ZipEntry instances.

private void
positionAtCentralDirectory()

Searches for either the "Zip64 end of central directory locator" or the "End of central dir record", parses it and positions the stream at the first central directory record.

private void
positionAtCentralDirectory32()

Searches for the "End of central dir record", parses it and positions the stream at the first central directory record.

private void
positionAtCentralDirectory64()

Parses the "Zip64 end of central directory locator", finds the "Zip64 end of central directory record" using the parsed information, parses that and positions the stream at the first central directory record.

private void
positionAtEndOfCentralDirectoryRecord()

Searches for the and positions the stream at the start of the "End of central dir record".

private void
readCentralDirectoryEntry(final Map<ZipEntry, ZipFile.NameAndComment>
map used to collect entries that don't have their UTF-8 flag set and whose name will be set by data read from the local file header later. The current entry may be added to this map.
noUTF8Flag
)

Reads an individual entry of the central directory, creates an ZipEntry from it and adds it to the global maps.

private void
resolveLocalFileHeaderData(final Map<ZipEntry, ZipFile.NameAndComment> entriesWithoutUTF8Flag)

Walks through all recorded entries and adds the data available from the local file header.

private void
setSizesAndOffsetFromZip64Extra(final ZipEntry ze, final ZipFile.OffsetEntry offset, final int diskStart)

If the entry holds a Zip64 extended information extra field, read sizes from there if the entry's sizes are set to 0xFFFFFFFFF, do the same for the offset of the local file header.

private void
skipBytes(final int count)

Skips the given number of bytes or throws an EOFException if skipping failed.

private boolean
startsWithLocalFileHeader()

Checks whether the archive starts with a LFH.

private boolean
tryToLocateSignature(final long minDistanceFromEnd, final long maxDistanceFromEnd, final byte[] sig)

Searches the archive backwards from minDistance to maxDistance for the given signature, positions the RandomAccessFile right at the signature if it has been found.

Inherited from java.lang.Object:
cloneequalsgetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

archiveback to summary
private final RandomAccessFile archive

The actual data source.

archiveNameback to summary
private final String archiveName

File name of actual source.

BYTE_SHIFTback to summary
pack-priv static final int BYTE_SHIFT
CFD_LOCATOR_OFFSETback to summary
private static final int CFD_LOCATOR_OFFSET

Offset of the field that holds the location of the first central directory entry inside the "End of central directory record" relative to the start of the "End of central directory record".

CFH_BUFback to summary
private final byte[] CFH_BUF
CFH_LENback to summary
private static final int CFH_LEN

Length of a "central directory" entry structure without file name, extra fields or comment.

CFH_SIGback to summary
private static final long CFH_SIG
closedback to summary
private volatile boolean closed

Whether the file is closed.

DWORD_BUFback to summary
private final byte[] DWORD_BUF
encodingback to summary
private final String encoding

The encoding to use for filenames and the file comment.

For a list of possible values see https://docs.oracle.com/javase/8/docs/technotes/guides/intl/encoding.doc.html. Defaults to the platform's default character encoding.

entriesback to summary
private final List<ZipEntry> entries

List of entries in the order they appear inside the central directory.

HASH_SIZEback to summary
private static final int HASH_SIZE
LFH_OFFSET_FOR_FILENAME_LENGTHback to summary
private static final long LFH_OFFSET_FOR_FILENAME_LENGTH

Number of bytes in local file header up to the "length of filename" entry.

MAX_EOCD_SIZEback to summary
private static final int MAX_EOCD_SIZE

Maximum length of the "End of central directory record" with a file comment.

MIN_EOCD_SIZEback to summary
private static final int MIN_EOCD_SIZE

Length of the "End of central directory record" - which is supposed to be the last structure of the archive - without file comment.

nameMapback to summary
private final Map<String, LinkedList<ZipEntry>> nameMap

Maps String to list of ZipEntrys, name -> actual entries.

NIBLET_MASKback to summary
pack-priv static final int NIBLET_MASK
OFFSET_COMPARATORback to summary
private final Comparator<ZipEntry> OFFSET_COMPARATOR

Compares two ZipEntries based on their offset within the archive.

Won't return any meaningful results if one of the entries isn't part of the archive at all.

Since
Ant 1.9.0
POS_0back to summary
private static final int POS_0
POS_1back to summary
private static final int POS_1
POS_2back to summary
private static final int POS_2
POS_3back to summary
private static final int POS_3
SHORT_BUFback to summary
private final byte[] SHORT_BUF
useUnicodeExtraFieldsback to summary
private final boolean useUnicodeExtraFields

Whether to look for and use Unicode extra fields.

WORD_BUFback to summary
private final byte[] WORD_BUF
ZIP64_EOCD_CFD_LOCATOR_OFFSETback to summary
private static final int ZIP64_EOCD_CFD_LOCATOR_OFFSET

Offset of the field that holds the location of the first central directory entry inside the "Zip64 end of central directory record" relative to the start of the "Zip64 end of central directory record".

ZIP64_EOCDL_LENGTHback to summary
private static final int ZIP64_EOCDL_LENGTH

Length of the "Zip64 end of central directory locator" - which should be right in front of the "end of central directory record" if one is present at all.

ZIP64_EOCDL_LOCATOR_OFFSETback to summary
private static final int ZIP64_EOCDL_LOCATOR_OFFSET

Offset of the field that holds the location of the "Zip64 end of central directory record" inside the "Zip64 end of central directory locator" relative to the start of the "Zip64 end of central directory locator".

zipEncodingback to summary
private final ZipEncoding zipEncoding

The zip encoding to use for filenames and the file comment.

Constructor Detail

ZipFileback to summary
public ZipFile(final File f) throws IOException

Opens the given file for reading, assuming the platform's native encoding for file names.

Parameters
f:File

the archive.

Exceptions
IOException:
if an error occurs while reading the file.
ZipFileback to summary
public ZipFile(final String name) throws IOException

Opens the given file for reading, assuming the platform's native encoding for file names.

Parameters
name:String

name of the archive.

Exceptions
IOException:
if an error occurs while reading the file.
ZipFileback to summary
public ZipFile(final String name, final String encoding) throws IOException

Opens the given file for reading, assuming the specified encoding for file names, scanning unicode extra fields.

Parameters
name:String

name of the archive.

encoding:String

the encoding to use for file names, use null for the platform's default encoding

Exceptions
IOException:
if an error occurs while reading the file.
ZipFileback to summary
public ZipFile(final File f, final String encoding) throws IOException

Opens the given file for reading, assuming the specified encoding for file names and scanning for unicode extra fields.

Parameters
f:File

the archive.

encoding:String

the encoding to use for file names, use null for the platform's default encoding

Exceptions
IOException:
if an error occurs while reading the file.
ZipFileback to summary
public ZipFile(final File f, final String encoding, final boolean useUnicodeExtraFields) throws IOException

Opens the given file for reading, assuming the specified encoding for file names.

Parameters
f:File

the archive.

encoding:String

the encoding to use for file names, use null for the platform's default encoding

useUnicodeExtraFields:boolean

whether to use InfoZIP Unicode Extra Fields (if present) to set the file names.

Exceptions
IOException:
if an error occurs while reading the file.

Method Detail

canReadEntryDataback to summary
public boolean canReadEntryData(final ZipEntry ze)

Whether this class is able to read the given entry.

May return false if it is set up to use encryption or a compression method that hasn't been implemented yet.

Parameters
ze:ZipEntry

ZipEntry

Returns:boolean

boolean

closeback to summary
public void close() throws IOException

Implements java.io.Closeable.close.

Closes the archive.

Annotations
@Override
Exceptions
IOException:
if an error occurs closing the archive.
closeQuietlyback to summary
public static void closeQuietly(final ZipFile zipfile)

close a zipfile quietly; throw no io fault, do nothing on a null parameter

Parameters
zipfile:ZipFile

file to close, can be null

finalizeback to summary
protected void finalize() throws Throwable

Overrides java.lang.Object.finalize.

Ensures that the close method of this zipfile is called when there are no more references to it.

Annotations
@Override
Exceptions
Throwable:

Doc from java.lang.Object.finalize.

the Exception raised by this method

See Also
close()
getEncodingback to summary
public String getEncoding()

The encoding to use for filenames and the file comment.

Returns:String

null if using the platform's default character encoding.

getEntriesback to summary
public Enumeration<ZipEntry> getEntries()

Returns all entries.

Entries will be returned in the same order they appear within the archive's central directory.

Returns:Enumeration<ZipEntry>

all entries as ZipEntry instances

getEntriesback to summary
public Iterable<ZipEntry> getEntries(final String name)

Returns all named entries in the same order they appear within the archive's central directory.

Parameters
name:String

name of the entry.

Returns:Iterable<ZipEntry>

the Iterable<ZipEntry> corresponding to the given name

Since
1.9.2
getEntriesInPhysicalOrderback to summary
public Enumeration<ZipEntry> getEntriesInPhysicalOrder()

Returns all entries in physical order.

Entries will be returned in the same order their contents appear within the archive.

Returns:Enumeration<ZipEntry>

all entries as ZipEntry instances

Since
Ant 1.9.0
getEntriesInPhysicalOrderback to summary
public Iterable<ZipEntry> getEntriesInPhysicalOrder(final String name)

Returns all named entries in the same order their contents appear within the archive.

Parameters
name:String

name of the entry.

Returns:Iterable<ZipEntry>

the Iterable<ZipEntry> corresponding to the given name

Since
1.9.2
getEntryback to summary
public ZipEntry getEntry(final String name)

Returns a named entry - or null if no entry by that name exists.

If multiple entries with the same name exist the first entry in the archive's central directory by that name is returned.

Parameters
name:String

name of the entry.

Returns:ZipEntry

the ZipEntry corresponding to the given name - or null if not present.

getInputStreamback to summary
public InputStream getInputStream(final ZipEntry ze) throws IOException, ZipException

Returns an InputStream for reading the contents of the given entry.

Parameters
ze:ZipEntry

the entry to get the stream for.

Returns:InputStream

a stream to read the entry from.

Exceptions
IOException:
if unable to create an input stream from the zipentry
ZipException:
if the zipentry uses an unsupported feature
getNameback to summary
public String getName()
populateFromCentralDirectoryback to summary
private Map<ZipEntry, ZipFile.NameAndComment> populateFromCentralDirectory() throws IOException

Reads the central directory of the given archive and populates the internal tables with ZipEntry instances.

The ZipEntrys will know all data that can be obtained from the central directory alone, but not the data that requires the local file header or additional data to be read.

Returns:Map<ZipEntry, ZipFile.NameAndComment>

a map of zipentries that didn't have the language encoding flag set when read.

positionAtCentralDirectoryback to summary
private void positionAtCentralDirectory() throws IOException

Searches for either the "Zip64 end of central directory locator" or the "End of central dir record", parses it and positions the stream at the first central directory record.

positionAtCentralDirectory32back to summary
private void positionAtCentralDirectory32() throws IOException

Searches for the "End of central dir record", parses it and positions the stream at the first central directory record.

positionAtCentralDirectory64back to summary
private void positionAtCentralDirectory64() throws IOException

Parses the "Zip64 end of central directory locator", finds the "Zip64 end of central directory record" using the parsed information, parses that and positions the stream at the first central directory record.

positionAtEndOfCentralDirectoryRecordback to summary
private void positionAtEndOfCentralDirectoryRecord() throws IOException

Searches for the and positions the stream at the start of the "End of central dir record".

readCentralDirectoryEntryback to summary
private void readCentralDirectoryEntry(final Map<ZipEntry, ZipFile.NameAndComment> noUTF8Flag) throws IOException

Reads an individual entry of the central directory, creates an ZipEntry from it and adds it to the global maps.

Parameters
noUTF8Flag:Map<ZipEntry, ZipFile.NameAndComment>

map used to collect entries that don't have their UTF-8 flag set and whose name will be set by data read from the local file header later. The current entry may be added to this map.

resolveLocalFileHeaderDataback to summary
private void resolveLocalFileHeaderData(final Map<ZipEntry, ZipFile.NameAndComment> entriesWithoutUTF8Flag) throws IOException

Walks through all recorded entries and adds the data available from the local file header.

Also records the offsets for the data to read from the entries.

setSizesAndOffsetFromZip64Extraback to summary
private void setSizesAndOffsetFromZip64Extra(final ZipEntry ze, final ZipFile.OffsetEntry offset, final int diskStart) throws IOException

If the entry holds a Zip64 extended information extra field, read sizes from there if the entry's sizes are set to 0xFFFFFFFFF, do the same for the offset of the local file header.

Ensures the Zip64 extra either knows both compressed and uncompressed size or neither of both as the internal logic in ExtraFieldUtils forces the field to create local header data even if they are never used - and here a field with only one size would be invalid.

skipBytesback to summary
private void skipBytes(final int count) throws IOException

Skips the given number of bytes or throws an EOFException if skipping failed.

startsWithLocalFileHeaderback to summary
private boolean startsWithLocalFileHeader() throws IOException

Checks whether the archive starts with a LFH. If it doesn't, it may be an empty archive.

tryToLocateSignatureback to summary
private boolean tryToLocateSignature(final long minDistanceFromEnd, final long maxDistanceFromEnd, final byte[] sig) throws IOException

Searches the archive backwards from minDistance to maxDistance for the given signature, positions the RandomAccessFile right at the signature if it has been found.

org.apache.tools.zip back to summary

private Class ZipFile.BoundedInputStream

extends InputStream
Class Inheritance

InputStream that delegates requests to the underlying RandomAccessFile, making sure that only bytes from a certain range can be read.

Field Summary

Modifier and TypeField and Description
private boolean
private long
private long

Constructor Summary

AccessConstructor and Description
pack-priv
BoundedInputStream(final long start, final long remaining)

Method Summary

Modifier and TypeMethod and Description
pack-priv void
addDummy()

Inflater needs an extra dummy byte for nowrap - see Inflater's javadocs.

public int
read()

Implements abstract java.io.InputStream.read.

Reads the next byte of data from the input stream.
public int
read(final byte[]
the buffer into which the data is read.
b
,
final int
the start offset in array b at which the data is written.
off
,
int
the maximum number of bytes to read.
len
)

Overrides java.io.InputStream.read.

Reads up to len bytes of data from the input stream into an array of bytes.
Inherited from java.io.InputStream:
availableclosemarkmarkSupportednullInputStreamreadreadAllBytesreadNBytesreadNBytesresetskipskipNBytestransferTo

Field Detail

addDummyByteback to summary
private boolean addDummyByte
locback to summary
private long loc
remainingback to summary
private long remaining

Constructor Detail

BoundedInputStreamback to summary
pack-priv BoundedInputStream(final long start, final long remaining)

Method Detail

addDummyback to summary
pack-priv void addDummy()

Inflater needs an extra dummy byte for nowrap - see Inflater's javadocs.

readback to summary
public int read() throws IOException

Implements abstract java.io.InputStream.read.

Doc from java.io.InputStream.read.

Reads the next byte of data from the input stream. The value byte is returned as an int in the range 0 to 255. If no byte is available because the end of the stream has been reached, the value -1 is returned. This method blocks until input data is available, the end of the stream is detected, or an exception is thrown.

Returns:int

the next byte of data, or -1 if the end of the stream is reached.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs.
readback to summary
public int read(final byte[] b, final int off, int len) throws IOException

Overrides java.io.InputStream.read.

Doc from java.io.InputStream.read.

Reads up to len bytes of data from the input stream into an array of bytes. An attempt is made to read as many as len bytes, but a smaller number may be read. The number of bytes actually read is returned as an integer.

This method blocks until input data is available, end of file is detected, or an exception is thrown.

If len is zero, then no bytes are read and 0 is returned; otherwise, there is an attempt to read at least one byte. If no byte is available because the stream is at end of file, the value -1 is returned; otherwise, at least one byte is read and stored into b.

The first byte read is stored into element b[off], the next one into b[off+1], and so on. The number of bytes read is, at most, equal to len. Let k be the number of bytes actually read; these bytes will be stored in elements b[off] through b[off+k-1], leaving elements b[off+k] through b[off+len-1] unaffected.

In every case, elements b[0] through b[off-1] and elements b[off+len] through b[b.length-1] are unaffected.

Parameters
b:byte[]

the buffer into which the data is read.

off:int

the start offset in array b at which the data is written.

len:int

the maximum number of bytes to read.

Returns:int

the total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached.

Annotations
@Override
Exceptions
IOException:
If the first byte cannot be read for any reason other than end of file, or if the input stream has been closed, or if some other I/O error occurs.
org.apache.tools.zip back to summary

private Class ZipFile.Entry

extends ZipEntry
Class Inheritance

Extends ZipEntry to store the offset within the archive.

Field Summary

Modifier and TypeField and Description
private final ZipFile.OffsetEntry
Inherited from org.apache.tools.zip.ZipEntry:
CRC_UNKNOWNPLATFORM_FATPLATFORM_UNIX

Constructor Summary

AccessConstructor and Description
pack-priv
Entry(final ZipFile.OffsetEntry offset)

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(final Object
the reference object with which to compare.
other
)

Overrides org.apache.tools.zip.ZipEntry.equals.

Indicates whether some other object is "equal to" this one.
pack-priv ZipFile.OffsetEntry
public int
hashCode()

Overrides org.apache.tools.zip.ZipEntry.hashCode.

Get the hashCode of the entry.
Inherited from org.apache.tools.zip.ZipEntry:
addAsFirstExtraFieldaddExtraFieldclonegetCentralDirectoryExtragetExternalAttributesgetExtraFieldgetExtraFieldsgetExtraFieldsgetGeneralPurposeBitgetInternalAttributesgetLastModifiedDategetLocalFileDataExtragetMethodgetNamegetPlatformgetRawNamegetSizegetUnixModegetUnparseableExtraFieldDataisDirectoryremoveExtraFieldremoveUnparseableExtraFieldDatasetCentralDirectoryExtrasetComprSizesetExternalAttributessetExtrasetExtrasetExtraFieldssetGeneralPurposeBitsetInternalAttributessetMethodsetNamesetNamesetPlatformsetSizesetUnixMode

Field Detail

offsetEntryback to summary
private final ZipFile.OffsetEntry offsetEntry

Constructor Detail

Entryback to summary
pack-priv Entry(final ZipFile.OffsetEntry offset)

Method Detail

equalsback to summary
public boolean equals(final Object other)

Overrides org.apache.tools.zip.ZipEntry.equals.

Doc from org.apache.tools.zip.ZipEntry.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
other:Object

Doc from java.lang.Object.equals.

the reference object with which to compare.

Returns:boolean

Doc from java.lang.Object.equals.

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getOffsetEntryback to summary
pack-priv ZipFile.OffsetEntry getOffsetEntry()
hashCodeback to summary
public int hashCode()

Overrides org.apache.tools.zip.ZipEntry.hashCode.

Doc from org.apache.tools.zip.ZipEntry.hashCode.

Get the hashCode of the entry. This uses the name as the hashcode.

Returns:int

a hashcode.

Annotations
@Override
org.apache.tools.zip back to summary

private final Class ZipFile.NameAndComment

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final byte[]
private final byte[]

Constructor Summary

AccessConstructor and Description
private
NameAndComment(final byte[] name, final byte[] comment)

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

commentback to summary
private final byte[] comment
nameback to summary
private final byte[] name

Constructor Detail

NameAndCommentback to summary
private NameAndComment(final byte[] name, final byte[] comment)
org.apache.tools.zip back to summary

private final Class ZipFile.OffsetEntry

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private long
private long

Constructor Summary

AccessConstructor and Description
private

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

dataOffsetback to summary
private long dataOffset
headerOffsetback to summary
private long headerOffset

Constructor Detail

OffsetEntryback to summary
private OffsetEntry()