org.fuin.kickstart4j
Class AbstractFile

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

public abstract class AbstractFile
extends java.lang.Object

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


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

Constructor Detail

AbstractFile

public AbstractFile(java.io.File baseDir,
                    java.io.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(java.lang.String path,
                    java.lang.String filename,
                    java.lang.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 java.lang.String getPath()
Returns the path of the file.

Returns:
Path relative to the base directory.

getFilename

public final java.lang.String getFilename()
Returns the filename.

Returns:
Filename without path.

getMd5Hash

public final java.lang.String getMd5Hash()
Returns the hash code.

Returns:
MD5 hash code of the file.

getCanonicalPathAndFilename

public final java.lang.String getCanonicalPathAndFilename(java.io.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 java.lang.String getRelativeSlashPathAndFilename()
Returns a relative path and filename. A slash ("/") is used as path separator.

Returns:
Path and filename.

getSlashPath

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

Returns:
Path.

getDestFile

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

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


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