org.aeonscope.io
Interface IFileInfo

All Superinterfaces:
IJDOMProducer
All Known Implementing Classes:
FileInfo

public interface IFileInfo
extends IJDOMProducer

Defines an object that can provide additional information about a java.io.File other than what is available by default.

Author:
Brooke Kuhlmann

Method Summary
 String getBasename()
          Answers the base name of the file (i.e.
 String getElementName()
          The element name based on whether the file is a file, directory, or unknown.
 String getExtension()
          Answers the file extension.

Example: "example.txt" yields "txt".

 File getFile()
          Answers the associated file.
 String getLabel()
          The file label which is computed by capitalizing the first letter of the file base name.
 String getLastModifiedDate()
          Answers the last modified file date using the user defined or default format.
 String getLastModifiedTime()
          Answers the last modified file time using the user defined or default format.
 String getMD5Sum()
          Answers the MD5, 32-character hex checksum of a file only as calculation on a directory is excluded.
 String getName()
          Answers the name of the file.
 String getParent()
          Answers the parent path of the file.

Example: "/path/to/file/example.txt" yields "/path/to/file".

 String getPath()
          Answers the path to the file.

Example: "/file/path/example.txt" yields "/file/path/example.txt".

 String getSize()
          Answer the size of the file in human readable format or, in the case of directory, the size is a summation of all files and sub-directories.

Examples: 3 bytes, 12 KB, 10 MB, etc.

 String getType()
          The type of file.
 void setDateFormat(String format)
          Sets the format to use for displaying the date.

Example: yyyy-MM-dd

 void setFile(File file)
          Sets the file based upon the given file.
 void setFile(String path)
          Sets the file based on the given file path.
 void setTimeFormat(String format)
          Sets the format to use for displaying the time.

Example: HH:mm:ss

 
Methods inherited from interface org.aeonscope.xml.IJDOMProducer
asElement
 

Method Detail

getFile

File getFile()
Answers the associated file.

Returns:
The associated file, otherwise null.

getName

String getName()
Answers the name of the file.

Returns:
The file name if known, otherwise "?".

getElementName

String getElementName()
The element name based on whether the file is a file, directory, or unknown. Used when rendering the file information as an XML element.

Returns:
The element name as "file" or "directory", otherwise "unknown" if unable to determine.

getLabel

String getLabel()
The file label which is computed by capitalizing the first letter of the file base name.

Returns:
The file label, otherwise "?" if unknown.

getType

String getType()
The type of file. By default, the type is determined by file extension or, in the case of a directory, "directory" is used instead.

Returns:
The file type, otherwise "?" if unknown.

getBasename

String getBasename()
Answers the base name of the file (i.e. the file name minus the extension).

Example: "example.txt" yields "example".

Returns:
The file base name if known, otherwise "?".

getExtension

String getExtension()
Answers the file extension.

Example: "example.txt" yields "txt".

Returns:
The file extension, otherwise "?".

getParent

String getParent()
Answers the parent path of the file.

Example: "/path/to/file/example.txt" yields "/path/to/file".

Returns:
The parent path, otherwise "?".

getPath

String getPath()
Answers the path to the file.

Example: "/file/path/example.txt" yields "/file/path/example.txt".

Returns:
The file path, otherwise "?".

getSize

String getSize()
Answer the size of the file in human readable format or, in the case of directory, the size is a summation of all files and sub-directories.

Examples: 3 bytes, 12 KB, 10 MB, etc.

Returns:
The size of a file or directory structure.

getMD5Sum

String getMD5Sum()
Answers the MD5, 32-character hex checksum of a file only as calculation on a directory is excluded.

Returns:
The file checksum, otherwise "?".

getLastModifiedDate

String getLastModifiedDate()
Answers the last modified file date using the user defined or default format.

Returns:
The formatted date, otherwise "?".

getLastModifiedTime

String getLastModifiedTime()
Answers the last modified file time using the user defined or default format.

Returns:
The formatted time, otherwise "?".

setFile

void setFile(String path)
Sets the file based on the given file path.

Parameters:
path - The file path to set.

setFile

void setFile(File file)
Sets the file based upon the given file.

Parameters:
file - The file.

setDateFormat

void setDateFormat(String format)
Sets the format to use for displaying the date.

Example: yyyy-MM-dd

Parameters:
format - The date format.
See Also:
java.text#SimpleDateFormat

setTimeFormat

void setTimeFormat(String format)
Sets the format to use for displaying the time.

Example: HH:mm:ss

Parameters:
format - The time format.
See Also:
java.text#SimpleDateFormat