org.at4j.zip
Class ZipDirectoryEntry

java.lang.Object
  extended by org.at4j.archive.AbstractArchiveEntry<ZipEntry,ZipDirectoryEntry>
      extended by org.at4j.zip.ZipEntry
          extended by org.at4j.zip.ZipDirectoryEntry
All Implemented Interfaces:
ArchiveDirectoryEntry<ZipEntry,ZipDirectoryEntry>, ArchiveEntry<ZipEntry,ZipDirectoryEntry>, Lockable, ReadLockable, Named

public class ZipDirectoryEntry
extends ZipEntry
implements ArchiveDirectoryEntry<ZipEntry,ZipDirectoryEntry>

This object represents a directory entry in a Zip file. In addition to the properties inherited from ZipEntry, it contains a collection of child entries.

Zip entries are always immutable.

Since:
1.0
Author:
Karl Gustafsson
See Also:
ZipFileEntry, ZipSymbolicLinkEntry

Constructor Summary
ZipDirectoryEntry(ZipEntryCollaborator collaborator, AbsoluteLocation loc, Map<String,ZipEntry> childEntries)
          Create a new Zip directory entry.
ZipDirectoryEntry(ZipEntryCollaborator collaborator, ZipEntryCentralFileHeaderData zecd, ZipEntryLocalFileHeaderData zeld, Map<String,ZipEntry> childEntries)
          Create a new Zip directory entry.
 
Method Summary
 Map<String,ZipEntry> getChildEntries()
          Get a read only Map containing this directory entry's child entries, if any.
 boolean isEmpty()
          Is this directory entry empty? (I.e: does it not contain any child entries?)
 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

ZipDirectoryEntry

public ZipDirectoryEntry(ZipEntryCollaborator collaborator,
                         AbsoluteLocation loc,
                         Map<String,ZipEntry> childEntries)
Create a new Zip directory entry. This constructor is only used for Zip directory entries that don't have an actual entry in the Zip file, but that has child entries anyway.

Parameters:
collaborator - The parent Zip archive's entry collaborator.
loc - The directory entry's location in the Zip archive.
childEntries - A map containing this entry's child entries, with the entries' names as keys. This may be null.

ZipDirectoryEntry

public ZipDirectoryEntry(ZipEntryCollaborator collaborator,
                         ZipEntryCentralFileHeaderData zecd,
                         ZipEntryLocalFileHeaderData zeld,
                         Map<String,ZipEntry> childEntries)
Create a new Zip directory entry.

Parameters:
collaborator - The parent Zip archive's entry collaborator.
zecd - Data parsed from the Zip entry's record in the central directory.
zeld - Data parsed from the Zip entry's local header.
childEntries - A map containing this entry's child entries, with the entries' names as keys. This may be null.
Method Detail

getChildEntries

public Map<String,ZipEntry> getChildEntries()
Description copied from interface: ArchiveDirectoryEntry
Get a read only Map containing this directory entry's child entries, if any. The map's keys are the child entries' names (not including the path up to and including this directory).

Specified by:
getChildEntries in interface ArchiveDirectoryEntry<ZipEntry,ZipDirectoryEntry>
Returns:
A read only Map containing this entry's child entries.

isEmpty

public boolean isEmpty()
Description copied from interface: ArchiveDirectoryEntry
Is this directory entry empty? (I.e: does it not contain any child entries?)

Specified by:
isEmpty in interface ArchiveDirectoryEntry<ZipEntry,ZipDirectoryEntry>
Returns:
true if the directory entry is empty.

toString

public String toString()
Overrides:
toString in class Object