se.entitymanager.logic.file
Class ZippedDirectoryFile

java.lang.Object
  extended by se.entitymanager.logic.file.AbstractFile
      extended by se.entitymanager.logic.file.ZippedDirectoryFile
All Implemented Interfaces:
EntityInterface

public class ZippedDirectoryFile
extends AbstractFile

An AbstractFile that represents a zipped directory within a ZipFile.

See Also:
ZipFile

Field Summary
private  java.util.List children
          List of children.
private  java.util.zip.ZipEntry zipEntry
          The zip entry that describes this directory.
private  java.util.zip.ZipFile zipFile
          The zip file that contains this directory.
 
Fields inherited from class se.entitymanager.logic.file.AbstractFile
fileContents, lastModified, name, parent, readable, size, writeable
 
Constructor Summary
protected ZippedDirectoryFile(java.util.zip.ZipFile zipFile, java.util.zip.ZipEntry zipEntry, AbstractFile parent)
          Constructs a zipped directory that is contained in zipFile, with zipEntry and parent.
 
Method Summary
private  boolean contains(java.util.zip.ZipEntry zipEntry)
          Checks whether this directory contains zipEntry.
protected  void copy()
          Copy this file.
protected  void delete()
          Deletes this file.
protected  java.util.List getAllChildren()
          Returns all direct child files.
 java.lang.String getFileContents()
          Returns the contents of this file.
 java.util.zip.ZipEntry getZipEntry()
          Returns the zip entry that describes this directory.
 java.util.zip.ZipFile getZipFile()
          Returns the zip file which contains this directory.
protected  boolean isFolderish()
          Returns whether this file is folderish.
protected  void paste()
          Paste the file from the clipboard.
protected  void rename(java.lang.String newName)
          Renames this file to newName.
 
Methods inherited from class se.entitymanager.logic.file.AbstractFile
getLastModified, getName, getParent, getSize, isReadable, isWriteable, setName, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

children

private java.util.List children
List of children.


zipFile

private java.util.zip.ZipFile zipFile
The zip file that contains this directory.


zipEntry

private java.util.zip.ZipEntry zipEntry
The zip entry that describes this directory.

Constructor Detail

ZippedDirectoryFile

protected ZippedDirectoryFile(java.util.zip.ZipFile zipFile,
                              java.util.zip.ZipEntry zipEntry,
                              AbstractFile parent)
Constructs a zipped directory that is contained in zipFile, with zipEntry and parent.

Parameters:
zipFile - the zip file that contains this directory
zipEntry - the zip entry that describes this directory
parent - the parent
Method Detail

getAllChildren

protected java.util.List getAllChildren()
                                 throws EntityNotFolderishException
Description copied from class: AbstractFile
Returns all direct child files.

The objects within the list are instances derived from AbstractFile

Specified by:
getAllChildren in class AbstractFile
Returns:
child files
Throws:
EntityNotFolderishException - if this file is not folderish

contains

private boolean contains(java.util.zip.ZipEntry zipEntry)
Checks whether this directory contains zipEntry.

Parameters:
zipEntry - the entry to look for
Returns:
true if this directory contains the entry; false otherwise

getZipFile

public java.util.zip.ZipFile getZipFile()
Returns the zip file which contains this directory.

Returns:
the zip file which contains this directory

getZipEntry

public java.util.zip.ZipEntry getZipEntry()
Returns the zip entry that describes this directory.

Returns:
the zip entry that describes this directory.

isFolderish

protected boolean isFolderish()
Description copied from class: AbstractFile
Returns whether this file is folderish.

Folderish files like directories or zip files may contain other files.

Specified by:
isFolderish in class AbstractFile
Returns:
true if this file is folderish, false otherwise

rename

protected void rename(java.lang.String newName)
               throws EntityRenameFailedException
Description copied from class: AbstractFile
Renames this file to newName.

Specified by:
rename in class AbstractFile
Parameters:
newName - new name of this file.
Throws:
EntityRenameFailedException - if an error occurred

delete

protected void delete()
               throws EntityDeletionFailedException
Description copied from class: AbstractFile
Deletes this file.

Specified by:
delete in class AbstractFile
Throws:
EntityDeletionFailedException - if an error occurred

copy

protected void copy()
             throws EntityCopyCutFailedException
Description copied from class: AbstractFile
Copy this file.

Specified by:
copy in class AbstractFile
Throws:
EntityCopyCutFailedException - if an error occurred

paste

protected void paste()
              throws EntityPasteFailedException
Description copied from class: AbstractFile
Paste the file from the clipboard.

Specified by:
paste in class AbstractFile
Throws:
EntityPasteFailedException - if an error occurred

getFileContents

public java.lang.String getFileContents()
Description copied from class: AbstractFile
Returns the contents of this file.

Specified by:
getFileContents in class AbstractFile
Returns:
size of file