|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.terrier.utility.io.LocalFileSystem
public class LocalFileSystem
This is a Terrier File Abstraction Layer implementation of the local file system. The file system implementation for the "file:" scheme can handle all file system capabilities (READ,WRITE,RANDOM_READ,RANDOM_WRITE,LS_DIR and STAT). Generally speaking, this is a lightweight wrapper around the following four Java SE classes: java.io.File and java.io.FileInputStream and java.io.FileOutputStream, java.io.RandomAccessFile.
On Windows, this FileSystem also advertises support for all the single-letter file systems, eg A:, C:, D:
Nested Class Summary | |
---|---|
protected static class |
LocalFileSystem.LocalRandomAccessFile
|
Field Summary |
---|
Fields inherited from interface org.terrier.utility.Files.FSCapability |
---|
DEL_ON_EXIT, LS_DIR, RANDOM_READ, RANDOM_WRITE, READ, STAT, WRITE |
Constructor Summary | |
---|---|
LocalFileSystem()
|
Method Summary | |
---|---|
boolean |
canRead(java.lang.String filename)
returns true if filename can be read |
boolean |
canWrite(java.lang.String filename)
returns true if filename can be written to |
byte |
capabilities()
Get the capabilities of the file system |
boolean |
delete(java.lang.String filename)
Delete a file |
boolean |
deleteOnExit(java.lang.String pathname)
Delete the file on program exit |
boolean |
exists(java.lang.String filename)
Does the file exist? |
java.lang.String |
getParent(java.lang.String path)
whats the parent path to this path - eg directory containing a file |
boolean |
isDirectory(java.lang.String path)
Does the path point to a directory |
long |
length(java.lang.String filename)
What is the length of the file? |
java.lang.String[] |
list(java.lang.String path)
list contents of a directory etc |
boolean |
mkdir(java.lang.String filename)
Make a directory |
java.lang.String |
name()
Get the name of the file system |
protected java.lang.String |
normalise(java.lang.String filename)
|
RandomDataInput |
openFileRandom(java.lang.String filename)
Opens an input random access file |
java.io.InputStream |
openFileStream(java.lang.String filename)
Opens an input file |
boolean |
rename(java.lang.String source,
java.lang.String destination)
rename a file/dir to another name, on the same file system |
java.lang.String[] |
schemes()
Get the schemes |
RandomDataOutput |
writeFileRandom(java.lang.String filename)
Opens a writable random access file |
java.io.OutputStream |
writeFileStream(java.lang.String filename)
Opens an output file |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LocalFileSystem()
Method Detail |
---|
protected java.lang.String normalise(java.lang.String filename)
public java.lang.String name()
name
in interface FileSystem
public byte capabilities()
capabilities
in interface FileSystem
public java.lang.String[] schemes()
schemes
in interface FileSystem
public boolean exists(java.lang.String filename)
exists
in interface FileSystem
public boolean canRead(java.lang.String filename)
canRead
in interface FileSystem
public boolean canWrite(java.lang.String filename)
canWrite
in interface FileSystem
public java.io.InputStream openFileStream(java.lang.String filename) throws java.io.IOException
openFileStream
in interface FileSystem
java.io.IOException
public java.io.OutputStream writeFileStream(java.lang.String filename) throws java.io.IOException
writeFileStream
in interface FileSystem
java.io.IOException
public RandomDataInput openFileRandom(java.lang.String filename) throws java.io.IOException
openFileRandom
in interface FileSystem
java.io.IOException
public RandomDataOutput writeFileRandom(java.lang.String filename) throws java.io.IOException
writeFileRandom
in interface FileSystem
java.io.IOException
public boolean delete(java.lang.String filename)
delete
in interface FileSystem
public boolean deleteOnExit(java.lang.String pathname) throws java.io.IOException
deleteOnExit
in interface FileSystem
java.io.IOException
public boolean mkdir(java.lang.String filename)
mkdir
in interface FileSystem
public boolean isDirectory(java.lang.String path)
isDirectory
in interface FileSystem
public long length(java.lang.String filename)
length
in interface FileSystem
public boolean rename(java.lang.String source, java.lang.String destination) throws java.io.IOException
rename
in interface FileSystem
java.io.IOException
public java.lang.String getParent(java.lang.String path) throws java.io.IOException
getParent
in interface FileSystem
java.io.IOException
public java.lang.String[] list(java.lang.String path) throws java.io.IOException
list
in interface FileSystem
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |