Interface IDfFile


public interface IDfFile
DfFile encapsulates a file specification. It provides access methods for various portions of a file path. It closely resembles java.io.File.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Returns true if caller has read permission on the file and the underlying file system / OS determines the file can be opened for reading.
    boolean
    Returns true if caller has write permission on the file and the underlying file system / OS determines the file can be opened for writing.
    void
    Deletes the file in the file system.
    boolean
    equals(Object fileSpec)
    Returns true if the argument is an instance of an IDfFile and it represents the same file path as this object.
    boolean
    Returns true if the file path references an actual file.
    Returns the path up to but not including the file name / extension.
    Returns the extension portion of the file name, if any.
    Returns the absolute path for the file.
    Return the absolute mac resource file path.
    Returns just the file name portion of the path.
    Returns the string (usually one character) that is used as the path element separator (e.g.
    Return the absolute path for the file as a URI.
    void
    renameTo(String newPath)
    Renames the file on disk to the specified name.
    void
    Sets the directory path for the file.
    void
    setExtension(String newExtension)
    Sets the extension portion of the file name.
    void
    setFullPath(String filePath)
    Sets the absolute path for the file.
    void
    Set the absolute Mac Resource File Path
    void
    setName(String fileName)
    Sets a new file name.
  • Method Details

    • getName

      String getName()
      Returns just the file name portion of the path. The file name also includes any extension.
      Returns:
      file name portion of the path.
    • setName

      void setName(String fileName)
      Sets a new file name. The file name also should include any extension.
      Parameters:
      fileName - new file name; will be appended to existing dir path to form complete path.
    • getExtension

      String getExtension()
      Returns the extension portion of the file name, if any. If the file name does not have an extension, null is returned. Extension string returned does not include the "." (e.g. "hello.txt" would return an extension of "txt").
      Returns:
      file extension or null if the file name has no extension.
    • setExtension

      void setExtension(String newExtension)
      Sets the extension portion of the file name. The "." may or may not be included (e.g. ".txt" and "txt" are both valid newExtension parameters).
      Parameters:
      newExtension - new extennsion to set.
    • getDirectory

      String getDirectory()
      Returns the path up to but not including the file name / extension.
      Returns:
      directory path.
    • setDirectory

      void setDirectory(String dirPath)
      Sets the directory path for the file. The existing file name / extension are preserved.
      Parameters:
      dirPath - new directory path string..
    • getFullPath

      String getFullPath()
      Returns the absolute path for the file.
      Returns:
      the absolute path for the file.
    • setFullPath

      void setFullPath(String filePath)
      Sets the absolute path for the file.
      Parameters:
      filePath - new absolute file path.
    • getSeparator

      String getSeparator()
      Returns the string (usually one character) that is used as the path element separator (e.g. in DOS it would be '\').
      Returns:
      file separator for the current OS / file system.
    • exists

      boolean exists()
      Returns true if the file path references an actual file.
      Returns:
      true if the file path references an actual file.
    • renameTo

      void renameTo(String newPath)
      Renames the file on disk to the specified name.
      Parameters:
      newPath - new file name.
    • deleteFile

      void deleteFile()
      Deletes the file in the file system.
    • canRead

      boolean canRead()
      Returns true if caller has read permission on the file and the underlying file system / OS determines the file can be opened for reading.
      Returns:
      true if the file can be opened for reading.
    • canWrite

      boolean canWrite()
      Returns true if caller has write permission on the file and the underlying file system / OS determines the file can be opened for writing.
      Returns:
      true if the file can be opened for writing.
    • equals

      boolean equals(Object fileSpec)
      Returns true if the argument is an instance of an IDfFile and it represents the same file path as this object. If the argument is not an instance of an IDfFile, this method returns false.
      Overrides:
      equals in class Object
      Parameters:
      fileSpec - another object
      Returns:
      true if the argument fileSpec is equal to this one; false otherwise.
    • getURI

      String getURI() throws DfException
      Return the absolute path for the file as a URI.
      Returns:
      the absolute path for the file as a URI.
      Throws:
      DfException
    • setMacResourcePath

      void setMacResourcePath(String macFilePath)
      Set the absolute Mac Resource File Path
      Parameters:
      macFilePath -
    • getMacResourcePath

      String getMacResourcePath()
      Return the absolute mac resource file path.
      Returns:
      absolute mac resource file path