de.waldheinz.fs
Interface FsDirectoryEntry

All Superinterfaces:
FsObject
All Known Implementing Classes:
FatLfnDirectoryEntry

public interface FsDirectoryEntry
extends FsObject

Represents one entry in a FsDirectory.

Author:
Ewout Prangsma <epr at jnode.org>, Matthias Treydte <waldheinz at gmail.com>

Field Summary
static Comparator<FsDirectoryEntry> DIRECTORY_ENTRY_COMPARATOR
          Compares directory entries alphabetically, with all directories coming before all files.
 
Method Summary
 long getCreated()
          Returns the time when this entry was created as ms since 1970.
 FsDirectory getDirectory()
          Gets the directory this entry refers to.
 FsFile getFile()
          Gets the file this entry refers to.
 long getLastAccessed()
          Returns the time when this entry was last accessed as ms since 1970.
 long getLastModified()
          Gets the last modification time of this entry.
 String getName()
          Gets the name of this entry.
 FsDirectory getParent()
          Deprecated. deprecated since version 0.6 because in the presence of hard links it might not always be possible to determine the parent directory of an entry
 boolean isDirectory()
          Is this entry refering to a (sub-)directory?
 boolean isDirty()
          Indicate if the entry has been modified in memory (ie need to be saved)
 boolean isFile()
          Is this entry refering to a file?
 void setLastModified(long lastModified)
          Sets the last modification time of this entry.
 void setName(String newName)
          Sets the name of this entry.
 
Methods inherited from interface de.waldheinz.fs.FsObject
isReadOnly, isValid
 

Field Detail

DIRECTORY_ENTRY_COMPARATOR

static final Comparator<FsDirectoryEntry> DIRECTORY_ENTRY_COMPARATOR
Compares directory entries alphabetically, with all directories coming before all files.

Method Detail

getName

String getName()
Gets the name of this entry.

Returns:
this entrys name

getParent

@Deprecated
FsDirectory getParent()
Deprecated. deprecated since version 0.6 because in the presence of hard links it might not always be possible to determine the parent directory of an entry

Gets the directory this entry is a part of.

Returns:
the parent directory of this entry, or null

getLastModified

long getLastModified()
                     throws IOException
Gets the last modification time of this entry.

Returns:
the last modification time of the entry as milliseconds since 1970, or 0 if this filesystem does not support getting the last modification time
Throws:
IOException - if an error occurs retrieving the time stamp

getCreated

long getCreated()
                throws IOException
Returns the time when this entry was created as ms since 1970.

Returns:
the creation time, or 0 if this feature is not supported
Throws:
IOException - on error retrieving the time stamp

getLastAccessed

long getLastAccessed()
                     throws IOException
Returns the time when this entry was last accessed as ms since 1970.

Returns:
the last access time, or 0 if this feature is not supported
Throws:
IOException - on error retrieving the last access time

isFile

boolean isFile()
Is this entry refering to a file?

Returns:
if this entry refers to a file

isDirectory

boolean isDirectory()
Is this entry refering to a (sub-)directory?

Returns:
if this entry refers to a directory

setName

void setName(String newName)
             throws IOException
Sets the name of this entry.

Parameters:
newName - the new name of this entry
Throws:
IOException - on error setting the new name

setLastModified

void setLastModified(long lastModified)
                     throws IOException
Sets the last modification time of this entry.

Parameters:
lastModified - the new last modification time of this entry
Throws:
IOException - on write error

getFile

FsFile getFile()
               throws IOException
Gets the file this entry refers to. This method can only be called if isFile returns true.

Returns:
the file described by this entry
Throws:
IOException - on error accessing the file

getDirectory

FsDirectory getDirectory()
                         throws IOException
Gets the directory this entry refers to. This method can only be called if isDirectory returns true.

Returns:
The directory described by this entry
Throws:
IOException - on read error

isDirty

boolean isDirty()
Indicate if the entry has been modified in memory (ie need to be saved)

Returns:
true if the entry needs to be saved


Copyright © 2014. All rights reserved.