|
Terrier IR Platform 2.2.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object uk.ac.gla.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:
Field Summary |
---|
Fields inherited from interface uk.ac.gla.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()
capabilities of the filesystem |
boolean |
delete(java.lang.String filename)
delete the named file |
boolean |
deleteOnExit(java.lang.String pathname)
delete the file after the JVM exits |
boolean |
exists(java.lang.String filename)
returns true if the path exists |
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)
returns true if path is a directory |
long |
length(java.lang.String filename)
returns the length of the specified file |
java.lang.String[] |
list(java.lang.String path)
list contents of a directory etc |
boolean |
mkdir(java.lang.String filename)
mkdir the specified path |
java.lang.String |
name()
returns a name for the filesystem |
RandomDataInput |
openFileRandom(java.lang.String filename)
open a file for random input |
java.io.InputStream |
openFileStream(java.lang.String filename)
open a file of given filename for readinng |
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()
URI schemes supported by this class |
RandomDataOutput |
writeFileRandom(java.lang.String filename)
open a file of given filename for random writing |
java.io.OutputStream |
writeFileStream(java.lang.String filename)
open a file of given filename for writing |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LocalFileSystem()
Method Detail |
---|
public java.lang.String name()
FileSystem
name
in interface FileSystem
public byte capabilities()
FileSystem
capabilities
in interface FileSystem
public java.lang.String[] schemes()
FileSystem
schemes
in interface FileSystem
public boolean exists(java.lang.String filename)
FileSystem
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
FileSystem
openFileStream
in interface FileSystem
java.io.IOException
public java.io.OutputStream writeFileStream(java.lang.String filename) throws java.io.IOException
FileSystem
writeFileStream
in interface FileSystem
java.io.IOException
public RandomDataInput openFileRandom(java.lang.String filename) throws java.io.IOException
FileSystem
openFileRandom
in interface FileSystem
java.io.IOException
public RandomDataOutput writeFileRandom(java.lang.String filename) throws java.io.IOException
FileSystem
writeFileRandom
in interface FileSystem
java.io.IOException
public boolean delete(java.lang.String filename)
FileSystem
delete
in interface FileSystem
public boolean deleteOnExit(java.lang.String pathname) throws java.io.IOException
FileSystem
deleteOnExit
in interface FileSystem
java.io.IOException
public boolean mkdir(java.lang.String filename)
FileSystem
mkdir
in interface FileSystem
public boolean isDirectory(java.lang.String path)
FileSystem
isDirectory
in interface FileSystem
public long length(java.lang.String filename)
FileSystem
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
|
Terrier IR Platform 2.2.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |