Package org.fife.ui.rsyntaxtextarea
Class FileLocation
- java.lang.Object
-
- org.fife.ui.rsyntaxtextarea.FileLocation
-
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.
-
-
Constructor Summary
Constructors Constructor Description FileLocation()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static FileLocation
create(File file)
Creates aFileLocation
instance for the specified local file.static FileLocation
create(String fileFullPath)
Creates aFileLocation
instance for the specified local file.static FileLocation
create(URL url)
Creates aFileLocation
instance for the specified file.protected abstract long
getActualLastModified()
Returns the last time this file was modified, orTextEditorPane.LAST_MODIFIED_UNKNOWN
if this value cannot be computed (such as for a remote file).abstract String
getFileFullPath()
Returns the full path to the file.abstract String
getFileName()
Returns the name of the file.protected abstract InputStream
getInputStream()
Opens an input stream for reading from this file.protected abstract OutputStream
getOutputStream()
Opens an output stream for writing this file.abstract boolean
isLocal()
Returns whether this file location is a local file.abstract boolean
isLocalAndExists()
Returns whether this file location is a local file that already exists.boolean
isRemote()
Returns whether this file location is a remote location.
-
-
-
Method Detail
-
create
public static FileLocation create(String fileFullPath)
Creates aFileLocation
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 aFileLocation
instance for the specified local file.- Parameters:
file
- A local file.- Returns:
- The file's location.
-
create
public static FileLocation create(URL url)
Creates aFileLocation
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, orTextEditorPane.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()
-
getFileName
public abstract String getFileName()
Returns the name of the file.- Returns:
- The name of the file.
- See Also:
getFileFullPath()
-
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()
-
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:
isLocal()
-
isRemote
public boolean isRemote()
Returns whether this file location is a remote location.- Returns:
- Whether this is a remote file location.
-
-