Class FileLocation

java.lang.Object
org.fife.ui.rsyntaxtextarea.FileLocation
Direct Known Subclasses:
FileFileLocation, URLFileLocation

public abstract class FileLocation extends Object
Holds the location of a local or remote file. This provides a common way to read, write, and check properties of both local and remote files.
Version:
1.0
  • Constructor Details

    • FileLocation

      public FileLocation()
  • Method Details

    • create

      public static FileLocation create(String fileFullPath)
      Creates a FileLocation instance for the specified local file.
      Parameters:
      fileFullPath - The full path to a local file.
      Returns:
      The file's location.
    • create

      public static FileLocation create(File file)
      Creates a FileLocation instance for the specified local file.
      Parameters:
      file - A local file.
      Returns:
      The file's location.
    • create

      public static FileLocation create(URL url)
      Creates a FileLocation instance for the specified file.
      Parameters:
      url - The URL of a file.
      Returns:
      The file's location.
    • getActualLastModified

      protected abstract long getActualLastModified()
      Returns the last time this file was modified, or TextEditorPane.LAST_MODIFIED_UNKNOWN if this value cannot be computed (such as for a remote file).
      Returns:
      The last time this file was modified.
    • getFileFullPath

      public abstract String getFileFullPath()
      Returns the full path to the file. This will be stripped of sensitive information such as passwords for remote files.
      Returns:
      The full path to the file.
      See Also:
    • getFileName

      public abstract String getFileName()
      Returns the name of the file.
      Returns:
      The name of the file.
      See Also:
    • getInputStream

      protected abstract InputStream getInputStream() throws IOException
      Opens an input stream for reading from this file.
      Returns:
      The input stream.
      Throws:
      IOException - If the file does not exist, or some other IO error occurs.
    • getOutputStream

      protected abstract OutputStream getOutputStream() throws IOException
      Opens an output stream for writing this file.
      Returns:
      An output stream.
      Throws:
      IOException - If an IO error occurs.
    • isLocal

      public abstract boolean isLocal()
      Returns whether this file location is a local file.
      Returns:
      Whether this is a local file.
      See Also:
    • isLocalAndExists

      public abstract boolean isLocalAndExists()
      Returns whether this file location is a local file that already exists.
      Returns:
      Whether this file is local and actually exists.
      See Also:
    • isRemote

      public boolean isRemote()
      Returns whether this file location is a remote location.
      Returns:
      Whether this is a remote file location.