Terrier IR Platform
2.2.1

uk.ac.gla.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
Version:
$Revision: 1.4 $
Author:
Craig Macdonald

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
 

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.IOException
returns true if the path exists

Throws:
java.io.IOException

canRead

boolean canRead(java.lang.String filename)
                throws java.io.IOException
returns true if filename can be read

Throws:
java.io.IOException

canWrite

boolean canWrite(java.lang.String filename)
                 throws java.io.IOException
returns true if filename can be written to

Throws:
java.io.IOException

openFileStream

java.io.InputStream openFileStream(java.lang.String filename)
                                   throws java.io.IOException
open 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.IOException
open 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.IOException
delete the named file

Throws:
java.io.IOException

deleteOnExit

boolean deleteOnExit(java.lang.String pathname)
                     throws java.io.IOException
delete the file after the JVM exits

Throws:
java.io.IOException

mkdir

boolean mkdir(java.lang.String filename)
              throws java.io.IOException
mkdir the specified path

Throws:
java.io.IOException

length

long length(java.lang.String filename)
            throws java.io.IOException
returns the length of the specified file

Throws:
java.io.IOException

isDirectory

boolean isDirectory(java.lang.String path)
                    throws java.io.IOException
returns true if path is a directory

Throws:
java.io.IOException

rename

boolean rename(java.lang.String source,
               java.lang.String destination)
               throws java.io.IOException
rename 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.IOException
whats 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.IOException
list contents of a directory etc

Throws:
java.io.IOException

Terrier IR Platform
2.2.1

Terrier Information Retrieval Platform 2.2.1. Copyright 2004-2008 University of Glasgow