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 FileLocationcreate(File file)Creates aFileLocationinstance for the specified local file.static FileLocationcreate(String fileFullPath)Creates aFileLocationinstance for the specified local file.static FileLocationcreate(URL url)Creates aFileLocationinstance for the specified file.protected abstract longgetActualLastModified()Returns the last time this file was modified, orTextEditorPane.LAST_MODIFIED_UNKNOWNif this value cannot be computed (such as for a remote file).abstract StringgetFileFullPath()Returns the full path to the file.abstract StringgetFileName()Returns the name of the file.protected abstract InputStreamgetInputStream()Opens an input stream for reading from this file.protected abstract OutputStreamgetOutputStream()Opens an output stream for writing this file.abstract booleanisLocal()Returns whether this file location is a local file.abstract booleanisLocalAndExists()Returns whether this file location is a local file that already exists.booleanisRemote()Returns whether this file location is a remote location.
-
-
-
Method Detail
-
create
public static FileLocation create(String fileFullPath)
Creates aFileLocationinstance 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 aFileLocationinstance for the specified local file.- Parameters:
file- A local file.- Returns:
- The file's location.
-
create
public static FileLocation create(URL url)
Creates aFileLocationinstance 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_UNKNOWNif 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.
-
-