org.pf.file
Class FileInfo

java.lang.Object
  extended by org.pf.file.FileInfo

public class FileInfo
extends java.lang.Object

This data object holds the name, size and modification date of a file. The file can either be a normal file or one inside a zip archive.

Version:
1.3
Author:
Manfred Duchrow

Constructor Summary
FileInfo(java.io.File file)
          Initialize the new instance from the given file.
FileInfo(java.lang.String archiveName, java.util.zip.ZipEntry zipEntry)
          Initialize the new instance from the given zip file entry.
 
Method Summary
 java.io.File asFile()
          Returns the file this info objects describes or null if it is inside an archive.
 FileLocator asFileLocator()
          Returns a FileLocator that corresponds to the file specified by this FileInfo object.
 java.lang.String getArchiveName()
          Returns the name of the archive, the file is included in or null if the file is located in the normal directory structure.
 java.lang.String getFullName()
          Returns the path + name of the file.
 java.lang.String getLocation()
          Returns the full location name, that is in case of a normal file the path and filename combined.
 java.lang.String getName()
          Returns the name of the file (without any path).
 java.lang.String getPath()
          Returns the path (without filename) to the file.
 long getSize()
          Returns the size of the file in bytes
 boolean isInArchive()
          Returns the name of the archive, the file is included in or null if the file is located in the normal directory structure.
 long lastModified()
          Returns the timestamp of the file's last modification
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileInfo

public FileInfo(java.io.File file)
Initialize the new instance from the given file.


FileInfo

public FileInfo(java.lang.String archiveName,
                java.util.zip.ZipEntry zipEntry)
Initialize the new instance from the given zip file entry.

Method Detail

isInArchive

public boolean isInArchive()
Returns the name of the archive, the file is included in or null if the file is located in the normal directory structure.


getArchiveName

public java.lang.String getArchiveName()
Returns the name of the archive, the file is included in or null if the file is located in the normal directory structure.


getLocation

public java.lang.String getLocation()
Returns the full location name, that is in case of a normal file the path and filename combined. In case or an archived file it is the archive name + path + filename.
The path separator is a forward slash ('/') on any platform !


getFullName

public java.lang.String getFullName()
Returns the path + name of the file.
The path separator is a forward slash ('/') on any platform !


getPath

public java.lang.String getPath()
Returns the path (without filename) to the file.
The path separator is a forward slash ('/') on any platform !


getName

public java.lang.String getName()
Returns the name of the file (without any path).


getSize

public long getSize()
Returns the size of the file in bytes


lastModified

public long lastModified()
Returns the timestamp of the file's last modification


asFileLocator

public FileLocator asFileLocator()
Returns a FileLocator that corresponds to the file specified by this FileInfo object.


asFile

public java.io.File asFile()
Returns the file this info objects describes or null if it is inside an archive.