se.entitymanager.logic.file
Class FileFactory

java.lang.Object
  extended by se.entitymanager.logic.file.FileFactory

public class FileFactory
extends java.lang.Object

Factory class for files.

This class may be used to create objects that are instances derived from AbstractFile.


Field Summary
private static FileFactory factory
          Static factory instance.
 
Constructor Summary
private FileFactory()
          Constructs a file factory.
 
Method Summary
 AbstractFile createFile(java.lang.String name, AbstractFile parent)
          Factory method for files.
static FileFactory getInstance()
          Returns the instance of file factory.
private  boolean isZipFile(java.io.File file)
          Checks whether given file is a zip file.
private  boolean isZippedDirectory(java.lang.String name)
          Checks whether a zipped file is a zipped directory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

factory

private static FileFactory factory
Static factory instance.

See Also:
getInstance()
Constructor Detail

FileFactory

private FileFactory()
Constructs a file factory.

Method Detail

getInstance

public static FileFactory getInstance()
Returns the instance of file factory.

Returns:
instance of file factory

createFile

public AbstractFile createFile(java.lang.String name,
                               AbstractFile parent)
Factory method for files.

Creates AbstractFile objects with name and parent

Parameters:
name - name of file
parent - parent file
Returns:
AbstractFile object

isZipFile

private boolean isZipFile(java.io.File file)
Checks whether given file is a zip file.

Parameters:
file - file to check
Returns:
true if file is zip file, false otherwise

isZippedDirectory

private boolean isZippedDirectory(java.lang.String name)
Checks whether a zipped file is a zipped directory.

According to zip specification a zipped file is a zipped directory, if its name ends with a slash.

Parameters:
name - name of file within the zip file.
Returns:
true if file is a zipped directory, false otherwise