|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.at4j.archive.AbstractArchiveEntry<ZipEntry,ZipDirectoryEntry>
org.at4j.zip.ZipEntry
org.at4j.zip.ZipFileEntry
public class ZipFileEntry
This object represents a file entry in a Zip archive. In addition to the
properties inherited from the 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 Summary | |
---|---|
ZipFileEntry(ZipEntryCollaborator collaborator,
ZipEntryCentralFileHeaderData zecd,
ZipEntryLocalFileHeaderData zeld)
Create a new Zip file entry. |
Method Summary | |
---|---|
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. |
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 . |
EntityLock |
lockForWriting()
This method returns a dummy lock. |
ScatteringByteChannel |
openChannelForRead()
Open a ReadableByteChannel for reading from the file. |
RandomAccess |
openForRandomAccess(RandomAccessMode ram)
Open the file for random access in the specified mode. |
InputStream |
openForRead()
Opens the file for reading. |
String |
toString()
|
Methods inherited from class org.at4j.zip.ZipEntry |
---|
getComment, getDiskNumberStart, getExternalFileAttributes, getExtraField, getExtraFields, getGeneralPurposeBitFlags, getLastModified, getVersionNeededToExtract, getVersionUsedToCreate, isEncrypted, isStrongEncryption |
Methods inherited from class org.at4j.archive.AbstractArchiveEntry |
---|
getCollaborator, getLocation, getName, getParent, getReadLock, isReadLockedByCurrentThread, lockForReading |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.at4j.archive.ArchiveEntry |
---|
getLocation, getParent |
Methods inherited from interface org.entityfs.Named |
---|
getName |
Methods inherited from interface org.entityfs.lock.ReadLockable |
---|
getReadLock, isReadLockedByCurrentThread, lockForReading |
Constructor Detail |
---|
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.Method Detail |
---|
public boolean isCompressedPatchData()
true
if the Zip file entry is compressed patched data.public ZipEntryCompressionMethod getCompressionMethod()
public long getDataSize()
getUncompressedSize()
.
getDataSize
in interface ReadableFile
getUncompressedSize()
,
getSize()
public UnsignedInteger getUncompressedSize()
getSize()
.
getDataSize()
,
getCompressedSize()
public UnsignedInteger getCompressedSize()
getSize()
.
getSize()
,
getUncompressedSize()
public long getSize()
getCompressedSize()
.
getSize
in interface 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 EntityLock lockForWriting() throws LockTimeoutException
lockForWriting
in interface WriteLockable
LockTimeoutException
- If the lock acquiring timed out. (It is up
to the LockAcquiringStrategy
to decide if lock acquiring can time
out.)public EntityLock getWriteLock()
getWriteLock
in interface WriteLockable
public boolean isWriteLockedByCurrentThread()
true
.
isWriteLockedByCurrentThread
in interface WriteLockable
true
, always.public ScatteringByteChannel openChannelForRead() throws UnsupportedOperationException
ReadableFile
ReadableByteChannel
for reading from the file. The
semantics of this method is the same as for ReadableFile.openForRead()
.
Although a read lock on the file is required for the execution thread
opening the channel, the channel itself is not protected from access by
other threads. It can be protected by wrapping it in a
LockAwareReadableByteChannel
.
openChannelForRead
in interface ReadableFile
ReadableByteChannel
. The channel must be closed
by the caller. The channel may be a
ScatteringByteChannel
, but that is not
required.
UnsupportedOperationException
ReadableFile.openForRead()
public InputStream openForRead() throws UnsupportedCompressionMethodException, ZipFileParseException
ReadableFile
Although a read lock on the file is required for the execution thread
opening the stream, the stream itself is not protected from access by
other threads. It can be protected by wrapping it in a
LockAwareInputStream
.
openForRead
in interface ReadableFile
InputStream
on the file. The stream must be closed by
the caller.
UnsupportedCompressionMethodException
ZipFileParseException
public RandomAccess openForRandomAccess(RandomAccessMode ram) throws UnsupportedCompressionMethodException, UnsupportedOperationException, ZipFileParseException
RandomlyAccessibleFile
Although a read or write lock on the file is required for the execution
thread opening the RandomAccess
, the RandomAccess
object
itself is not protected from access by other threads. It can be protected
by wrapping it in a LockAwareRandomAccess
object.
openForRandomAccess
in interface RandomlyAccessibleFile
ram
- The mode to open the file in.
RandomAccess
object. It must be closed by the
caller.
UnsupportedCompressionMethodException
UnsupportedOperationException
ZipFileParseException
public String toString()
toString
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |