Package org.terrier.utility.io
Interface FileSystem
-
- All Known Implementing Classes:
HTTPFileSystem
,LocalFileSystem
,ResourceFileSystem
,StdInOutFileSystem
public interface FileSystem
This is the Terrier File Abstraction Layer interface depicting the operations available for a file system.- Since:
- 2.1
- Author:
- Craig Macdonald
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
canRead(java.lang.String filename)
returns true if filename can be readboolean
canWrite(java.lang.String filename)
returns true if filename can be written tobyte
capabilities()
capabilities of the filesystemboolean
delete(java.lang.String filename)
delete the named fileboolean
deleteOnExit(java.lang.String pathname)
delete the file after the JVM exitsboolean
exists(java.lang.String filename)
returns true if the path existsjava.lang.String
getParent(java.lang.String path)
whats the parent path to this path - eg directory containing a fileboolean
isDirectory(java.lang.String path)
returns true if path is a directorylong
length(java.lang.String filename)
returns the length of the specified filejava.lang.String[]
list(java.lang.String path)
list contents of a directory etcboolean
mkdir(java.lang.String filename)
mkdir the specified pathjava.lang.String
name()
returns a name for the filesystemRandomDataInput
openFileRandom(java.lang.String filename)
open a file for random inputjava.io.InputStream
openFileStream(java.lang.String filename)
open a file of given filename for readinngboolean
rename(java.lang.String source, java.lang.String destination)
rename a file/dir to another name, on the same file systemjava.lang.String[]
schemes()
URI schemes supported by this classRandomDataOutput
writeFileRandom(java.lang.String filename)
open a file of given filename for random writingjava.io.OutputStream
writeFileStream(java.lang.String filename)
open a file of given filename for writing
-
-
-
Method Detail
-
name
java.lang.String name()
returns a name for the filesystem
-
capabilities
byte capabilities()
capabilities of the filesystem
-
schemes
java.lang.String[] schemes()
URI schemes supported by this class
-
exists
boolean exists(java.lang.String filename) throws java.io.IOException
returns true if the path exists- Throws:
java.io.IOException
-
canRead
boolean canRead(java.lang.String filename) throws java.io.IOException
returns true if filename can be read- Throws:
java.io.IOException
-
canWrite
boolean canWrite(java.lang.String filename) throws java.io.IOException
returns true if filename can be written to- Throws:
java.io.IOException
-
openFileStream
java.io.InputStream openFileStream(java.lang.String filename) throws java.io.IOException
open a file of given filename for readinng- Throws:
java.io.IOException
-
openFileRandom
RandomDataInput openFileRandom(java.lang.String filename) throws java.io.IOException
open a file for random input- Throws:
java.io.IOException
-
writeFileStream
java.io.OutputStream writeFileStream(java.lang.String filename) throws java.io.IOException
open a file of given filename for writing- Throws:
java.io.IOException
-
writeFileRandom
RandomDataOutput writeFileRandom(java.lang.String filename) throws java.io.IOException
open a file of given filename for random writing- Throws:
java.io.IOException
-
delete
boolean delete(java.lang.String filename) throws java.io.IOException
delete the named file- Throws:
java.io.IOException
-
deleteOnExit
boolean deleteOnExit(java.lang.String pathname) throws java.io.IOException
delete the file after the JVM exits- Throws:
java.io.IOException
-
mkdir
boolean mkdir(java.lang.String filename) throws java.io.IOException
mkdir the specified path- Throws:
java.io.IOException
-
length
long length(java.lang.String filename) throws java.io.IOException
returns the length of the specified file- Throws:
java.io.IOException
-
isDirectory
boolean isDirectory(java.lang.String path) throws java.io.IOException
returns true if path is a directory- Throws:
java.io.IOException
-
rename
boolean rename(java.lang.String source, java.lang.String destination) throws java.io.IOException
rename a file/dir to another name, on the same file system- Throws:
java.io.IOException
-
getParent
java.lang.String getParent(java.lang.String path) throws java.io.IOException
whats the parent path to this path - eg directory containing a file- Throws:
java.io.IOException
-
list
java.lang.String[] list(java.lang.String path) throws java.io.IOException
list contents of a directory etc- Throws:
java.io.IOException
-
-