Package org.terrier.utility.io
Interface FileSystem
-
- All Known Implementing Classes:
HTTPFileSystem,LocalFileSystem,ResourceFileSystem,StdInOutFileSystem
public interface FileSystemThis 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 booleancanRead(java.lang.String filename)returns true if filename can be readbooleancanWrite(java.lang.String filename)returns true if filename can be written tobytecapabilities()capabilities of the filesystembooleandelete(java.lang.String filename)delete the named filebooleandeleteOnExit(java.lang.String pathname)delete the file after the JVM exitsbooleanexists(java.lang.String filename)returns true if the path existsjava.lang.StringgetParent(java.lang.String path)whats the parent path to this path - eg directory containing a filebooleanisDirectory(java.lang.String path)returns true if path is a directorylonglength(java.lang.String filename)returns the length of the specified filejava.lang.String[]list(java.lang.String path)list contents of a directory etcbooleanmkdir(java.lang.String filename)mkdir the specified pathjava.lang.Stringname()returns a name for the filesystemRandomDataInputopenFileRandom(java.lang.String filename)open a file for random inputjava.io.InputStreamopenFileStream(java.lang.String filename)open a file of given filename for readinngbooleanrename(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 classRandomDataOutputwriteFileRandom(java.lang.String filename)open a file of given filename for random writingjava.io.OutputStreamwriteFileStream(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.IOExceptionreturns true if the path exists- Throws:
java.io.IOException
-
canRead
boolean canRead(java.lang.String filename) throws java.io.IOExceptionreturns true if filename can be read- Throws:
java.io.IOException
-
canWrite
boolean canWrite(java.lang.String filename) throws java.io.IOExceptionreturns true if filename can be written to- Throws:
java.io.IOException
-
openFileStream
java.io.InputStream openFileStream(java.lang.String filename) throws java.io.IOExceptionopen 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.IOExceptionopen 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.IOExceptiondelete the named file- Throws:
java.io.IOException
-
deleteOnExit
boolean deleteOnExit(java.lang.String pathname) throws java.io.IOExceptiondelete the file after the JVM exits- Throws:
java.io.IOException
-
mkdir
boolean mkdir(java.lang.String filename) throws java.io.IOExceptionmkdir the specified path- Throws:
java.io.IOException
-
length
long length(java.lang.String filename) throws java.io.IOExceptionreturns the length of the specified file- Throws:
java.io.IOException
-
isDirectory
boolean isDirectory(java.lang.String path) throws java.io.IOExceptionreturns true if path is a directory- Throws:
java.io.IOException
-
rename
boolean rename(java.lang.String source, java.lang.String destination) throws java.io.IOExceptionrename 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.IOExceptionwhats 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.IOExceptionlist contents of a directory etc- Throws:
java.io.IOException
-
-