org.fuin.kickstart4j
Class AbstractFile

java.lang.Object
  extended by org.fuin.kickstart4j.AbstractFile
Direct Known Subclasses:
DestFile, SrcFile

public abstract class AbstractFile
extends Object

A file inside a base directory. This class is immutable.


Constructor Summary
AbstractFile(File baseDir, File file)
          Constructor with base directory and file.
AbstractFile(String path, String filename, String md5Hash)
          Constructor with all arguments.
 
Method Summary
 boolean equals(Object obj)
          
 String getCanonicalPathAndFilename(File baseDir)
          Returns the absolute file based on a given base directory as String.
 File getDestFile(File baseDir)
          Returns the absolute file based on a given base directory.
 String getFilename()
          Returns the filename.
 String getMd5Hash()
          Returns the hash code.
 String getPath()
          Returns the path of the file.
 String getRelativeSlashPathAndFilename()
          Returns a relative path and filename.
 String getSlashPath()
          Returns the path with a slash ("/") used as path separator.
 int hashCode()
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractFile

public AbstractFile(File baseDir,
                    File file)
Constructor with base directory and file.

Parameters:
baseDir - Base directory for calculating the relative path.
file - File inside the base directory.

AbstractFile

public AbstractFile(String path,
                    String filename,
                    String md5Hash)
Constructor with all arguments.

Parameters:
path - Path relative to the base directory.
filename - Filename without path.
md5Hash - MD5 hash code of the file.
Method Detail

getPath

public final String getPath()
Returns the path of the file.

Returns:
Path relative to the base directory.

getFilename

public final String getFilename()
Returns the filename.

Returns:
Filename without path.

getMd5Hash

public final String getMd5Hash()
Returns the hash code.

Returns:
MD5 hash code of the file.

getCanonicalPathAndFilename

public final String getCanonicalPathAndFilename(File baseDir)
Returns the absolute file based on a given base directory as String.

Parameters:
baseDir - Base directory.
Returns:
File path and name inside the base directory.

getRelativeSlashPathAndFilename

public final String getRelativeSlashPathAndFilename()
Returns a relative path and filename. A slash ("/") is used as path separator.

Returns:
Path and filename.

getSlashPath

public final String getSlashPath()
Returns the path with a slash ("/") used as path separator.

Returns:
Path.

getDestFile

public final File getDestFile(File baseDir)
Returns the absolute file based on a given base directory.

Parameters:
baseDir - Base directory.
Returns:
File inside the base directory.

hashCode

public final int hashCode()

Overrides:
hashCode in class Object

equals

public final boolean equals(Object obj)

Overrides:
equals in class Object


Copyright © 2011 Future Invent Informationsmanagement GmbH. All Rights Reserved.