org.terrier.utility.io
Interface FileSystem

All Known Implementing Classes:
HTTPFileSystem, LocalFileSystem

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
 boolean canRead(String filename)
          returns true if filename can be read
 boolean canWrite(String filename)
          returns true if filename can be written to
 byte capabilities()
          capabilities of the filesystem
 boolean delete(String filename)
          delete the named file
 boolean deleteOnExit(String pathname)
          delete the file after the JVM exits
 boolean exists(String filename)
          returns true if the path exists
 String getParent(String path)
          whats the parent path to this path - eg directory containing a file
 boolean isDirectory(String path)
          returns true if path is a directory
 long length(String filename)
          returns the length of the specified file
 String[] list(String path)
          list contents of a directory etc
 boolean mkdir(String filename)
          mkdir the specified path
 String name()
          returns a name for the filesystem
 RandomDataInput openFileRandom(String filename)
          open a file for random input
 InputStream openFileStream(String filename)
          open a file of given filename for readinng
 boolean rename(String source, String destination)
          rename a file/dir to another name, on the same file system
 String[] schemes()
          URI schemes supported by this class
 RandomDataOutput writeFileRandom(String filename)
          open a file of given filename for random writing
 OutputStream writeFileStream(String filename)
          open a file of given filename for writing
 

Method Detail

name

String name()
returns a name for the filesystem


capabilities

byte capabilities()
capabilities of the filesystem


schemes

String[] schemes()
URI schemes supported by this class


exists

boolean exists(String filename)
               throws IOException
returns true if the path exists

Throws:
IOException

canRead

boolean canRead(String filename)
                throws IOException
returns true if filename can be read

Throws:
IOException

canWrite

boolean canWrite(String filename)
                 throws IOException
returns true if filename can be written to

Throws:
IOException

openFileStream

InputStream openFileStream(String filename)
                           throws IOException
open a file of given filename for readinng

Throws:
IOException

openFileRandom

RandomDataInput openFileRandom(String filename)
                               throws IOException
open a file for random input

Throws:
IOException

writeFileStream

OutputStream writeFileStream(String filename)
                             throws IOException
open a file of given filename for writing

Throws:
IOException

writeFileRandom

RandomDataOutput writeFileRandom(String filename)
                                 throws IOException
open a file of given filename for random writing

Throws:
IOException

delete

boolean delete(String filename)
               throws IOException
delete the named file

Throws:
IOException

deleteOnExit

boolean deleteOnExit(String pathname)
                     throws IOException
delete the file after the JVM exits

Throws:
IOException

mkdir

boolean mkdir(String filename)
              throws IOException
mkdir the specified path

Throws:
IOException

length

long length(String filename)
            throws IOException
returns the length of the specified file

Throws:
IOException

isDirectory

boolean isDirectory(String path)
                    throws IOException
returns true if path is a directory

Throws:
IOException

rename

boolean rename(String source,
               String destination)
               throws IOException
rename a file/dir to another name, on the same file system

Throws:
IOException

getParent

String getParent(String path)
                 throws IOException
whats the parent path to this path - eg directory containing a file

Throws:
IOException

list

String[] list(String path)
              throws IOException
list contents of a directory etc

Throws:
IOException


Terrier 3.6. Copyright © 2004-2011 University of Glasgow