public class ZipFileEntry extends ZipEntry implements ArchiveFileEntry<ZipEntry,ZipDirectoryEntry>
ZipEntry
object, a file entry has some
properties of its own. The file's data is compressed using a
ZipEntryCompressionMethod
. The file has a set of internal file
attributes represented by a ZipInternalFileAttributes
object and the
entry keeps track of the compressed and the uncompressed size of the file
data, and the file has a CRC 32 checksum of its data.
Only the Zip file entries that are stored uncompressed (
StoredCompressionMethod
) support being opened for
random access. If it is stored with another compression method, its openForRandomAccess
method will throw an
UnsupportedOperationException
.
Zip entries are always immutable.
ZipDirectoryEntry
,
ZipSymbolicLinkEntry
Constructor and Description |
---|
ZipFileEntry(ZipEntryCollaborator collaborator,
ZipEntryCentralFileHeaderData zecd,
ZipEntryLocalFileHeaderData zeld)
Create a new Zip file entry.
|
Modifier and Type | Method and Description |
---|---|
UnsignedInteger |
getCompressedSize()
Get the size of the file data when as it is compressed in the Zip file.
|
ZipEntryCompressionMethod |
getCompressionMethod()
Get the compression method for the Zip file entry.
|
UnsignedInteger |
getCrc32()
Get the checksum calculated on the file contents.
|
long |
getDataSize()
Get the uncompressed size of file data.
|
long |
getSize()
Get the compressed size of the Zip file entry.
|
UnsignedInteger |
getUncompressedSize()
Get the size of the file data when it has been uncompressed.
|
org.entityfs.lock.EntityLock |
getWriteLock()
This method returns a dummy lock.
|
boolean |
isAppearingToBeTextFile()
Does this file appear to be a text file?
|
boolean |
isCompressedPatchData()
Is the Zip file entry compressed patched data?
|
boolean |
isWriteLockedByCurrentThread()
This method always returns
true . |
org.entityfs.lock.EntityLock |
lockForWriting()
This method returns a dummy lock.
|
ScatteringByteChannel |
openChannelForRead() |
org.entityfs.RandomAccess |
openForRandomAccess(org.entityfs.support.io.RandomAccessMode ram) |
InputStream |
openForRead() |
String |
toString() |
getComment, getDiskNumberStart, getExternalFileAttributes, getExtraField, getExtraFields, getGeneralPurposeBitFlags, getLastModified, getVersionNeededToExtract, getVersionUsedToCreate, isEncrypted, isStrongEncryption
getCollaborator, getLocation, getName, getParent, getReadLock, isReadLockedByCurrentThread, lockForReading
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getLocation, getParent
public ZipFileEntry(ZipEntryCollaborator collaborator, ZipEntryCentralFileHeaderData zecd, ZipEntryLocalFileHeaderData zeld)
collaborator
- The parent Zip archive's entry collaborator.zecd
- Data parsed from the file's record in the central directory.zeld
- Data parsed from the file entry's local header.public boolean isCompressedPatchData()
true
if the Zip file entry is compressed patched data.public ZipEntryCompressionMethod getCompressionMethod()
public long getDataSize()
getUncompressedSize()
.getDataSize
in interface org.entityfs.ReadableFile
getUncompressedSize()
,
getSize()
public UnsignedInteger getUncompressedSize()
getSize()
.getDataSize()
,
getCompressedSize()
public UnsignedInteger getCompressedSize()
getSize()
.getSize()
,
getUncompressedSize()
public long getSize()
getCompressedSize()
.getSize
in interface org.entityfs.ReadableFile
getDataSize()
,
getCompressedSize()
public UnsignedInteger getCrc32()
CRC32
public boolean isAppearingToBeTextFile()
true
if the file appears to be a text file, false
if it appears to be a binary file.public org.entityfs.lock.EntityLock lockForWriting() throws org.entityfs.exception.LockTimeoutException
lockForWriting
in interface org.entityfs.lock.WriteLockable
org.entityfs.exception.LockTimeoutException
public org.entityfs.lock.EntityLock getWriteLock()
getWriteLock
in interface org.entityfs.lock.WriteLockable
public boolean isWriteLockedByCurrentThread()
true
.isWriteLockedByCurrentThread
in interface org.entityfs.lock.WriteLockable
true
, always.public ScatteringByteChannel openChannelForRead() throws UnsupportedOperationException
openChannelForRead
in interface org.entityfs.ReadableFile
UnsupportedOperationException
public InputStream openForRead() throws UnsupportedCompressionMethodException, ZipFileParseException
openForRead
in interface org.entityfs.ReadableFile
UnsupportedCompressionMethodException
ZipFileParseException
public org.entityfs.RandomAccess openForRandomAccess(org.entityfs.support.io.RandomAccessMode ram) throws UnsupportedCompressionMethodException, UnsupportedOperationException, ZipFileParseException
openForRandomAccess
in interface org.entityfs.RandomlyAccessibleFile
UnsupportedCompressionMethodException
UnsupportedOperationException
ZipFileParseException