Package org.terrier.utility.io
Class StdInOutFileSystem
- java.lang.Object
-
- org.terrier.utility.io.StdInOutFileSystem
-
- All Implemented Interfaces:
FileSystem
public class StdInOutFileSystem extends java.lang.Object implements FileSystem
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringSCHEME
-
Constructor Summary
Constructors Constructor Description StdInOutFileSystem()
-
Method Summary
All Methods Instance Methods Concrete 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
-
-
-
Field Detail
-
SCHEME
public static final java.lang.String SCHEME
- See Also:
- Constant Field Values
-
-
Method Detail
-
name
public java.lang.String name()
Description copied from interface:FileSystemreturns a name for the filesystem- Specified by:
namein interfaceFileSystem
-
capabilities
public byte capabilities()
Description copied from interface:FileSystemcapabilities of the filesystem- Specified by:
capabilitiesin interfaceFileSystem
-
schemes
public java.lang.String[] schemes()
Description copied from interface:FileSystemURI schemes supported by this class- Specified by:
schemesin interfaceFileSystem
-
exists
public boolean exists(java.lang.String filename) throws java.io.IOExceptionDescription copied from interface:FileSystemreturns true if the path exists- Specified by:
existsin interfaceFileSystem- Throws:
java.io.IOException
-
canRead
public boolean canRead(java.lang.String filename) throws java.io.IOExceptionDescription copied from interface:FileSystemreturns true if filename can be read- Specified by:
canReadin interfaceFileSystem- Throws:
java.io.IOException
-
canWrite
public boolean canWrite(java.lang.String filename) throws java.io.IOExceptionDescription copied from interface:FileSystemreturns true if filename can be written to- Specified by:
canWritein interfaceFileSystem- Throws:
java.io.IOException
-
openFileStream
public java.io.InputStream openFileStream(java.lang.String filename) throws java.io.IOExceptionDescription copied from interface:FileSystemopen a file of given filename for readinng- Specified by:
openFileStreamin interfaceFileSystem- Throws:
java.io.IOException
-
openFileRandom
public RandomDataInput openFileRandom(java.lang.String filename) throws java.io.IOException
Description copied from interface:FileSystemopen a file for random input- Specified by:
openFileRandomin interfaceFileSystem- Throws:
java.io.IOException
-
writeFileStream
public java.io.OutputStream writeFileStream(java.lang.String filename) throws java.io.IOExceptionDescription copied from interface:FileSystemopen a file of given filename for writing- Specified by:
writeFileStreamin interfaceFileSystem- Throws:
java.io.IOException
-
writeFileRandom
public RandomDataOutput writeFileRandom(java.lang.String filename) throws java.io.IOException
Description copied from interface:FileSystemopen a file of given filename for random writing- Specified by:
writeFileRandomin interfaceFileSystem- Throws:
java.io.IOException
-
delete
public boolean delete(java.lang.String filename) throws java.io.IOExceptionDescription copied from interface:FileSystemdelete the named file- Specified by:
deletein interfaceFileSystem- Throws:
java.io.IOException
-
deleteOnExit
public boolean deleteOnExit(java.lang.String pathname) throws java.io.IOExceptionDescription copied from interface:FileSystemdelete the file after the JVM exits- Specified by:
deleteOnExitin interfaceFileSystem- Throws:
java.io.IOException
-
mkdir
public boolean mkdir(java.lang.String filename) throws java.io.IOExceptionDescription copied from interface:FileSystemmkdir the specified path- Specified by:
mkdirin interfaceFileSystem- Throws:
java.io.IOException
-
length
public long length(java.lang.String filename) throws java.io.IOExceptionDescription copied from interface:FileSystemreturns the length of the specified file- Specified by:
lengthin interfaceFileSystem- Throws:
java.io.IOException
-
isDirectory
public boolean isDirectory(java.lang.String path) throws java.io.IOExceptionDescription copied from interface:FileSystemreturns true if path is a directory- Specified by:
isDirectoryin interfaceFileSystem- Throws:
java.io.IOException
-
rename
public boolean rename(java.lang.String source, java.lang.String destination) throws java.io.IOExceptionDescription copied from interface:FileSystemrename a file/dir to another name, on the same file system- Specified by:
renamein interfaceFileSystem- Throws:
java.io.IOException
-
getParent
public java.lang.String getParent(java.lang.String path) throws java.io.IOExceptionDescription copied from interface:FileSystemwhats the parent path to this path - eg directory containing a file- Specified by:
getParentin interfaceFileSystem- Throws:
java.io.IOException
-
list
public java.lang.String[] list(java.lang.String path) throws java.io.IOExceptionDescription copied from interface:FileSystemlist contents of a directory etc- Specified by:
listin interfaceFileSystem- Throws:
java.io.IOException
-
-