net.sf.cotta
Interface FileSystem

All Known Implementing Classes:
CatastrophicFileSystem, ControlledFileSystem, InMemoryFileSystem, PhysicalFileSystem, ZipFileSystem

public interface FileSystem

The file system that handles the implementation of the file operations


Method Summary
 int compare(TPath path1, TPath path2)
          Compares the two path
 void createDir(TPath path)
           
 void createFile(TPath path)
          Create file pointed by the given path
 java.nio.channels.FileChannel createInputChannel(TPath path)
           
 java.io.InputStream createInputStream(TPath path)
           
 java.nio.channels.FileChannel createOutputChannel(TPath path, java.io.OutputStream outputStream)
           
 java.io.OutputStream createOutputStream(TPath path, OutputMode mode)
           
 void deleteDirectory(TPath path)
           
 void deleteFile(TPath path)
           
 boolean dirExists(TPath path)
           
 boolean equals(TPath path1, TPath path2)
          Check if two paths are equal.
 boolean fileExists(TPath path)
           
 long fileLastModified(TPath path)
           
 long fileLength(TPath path)
           
 int hashCode(TPath path)
          Returns the hash code for the path
 PathContent list(TPath path)
          List the content of the path
 void moveDirectory(TPath source, TPath destination)
           
 void moveFile(TPath source, TPath destination)
           
 java.lang.String pathString(TPath path)
           
 java.lang.String toCanonicalPath(TPath path)
           
 java.io.File toJavaFile(TPath path)
           
 

Method Detail

fileExists

boolean fileExists(TPath path)

createFile

void createFile(TPath path)
                throws TIoException
Create file pointed by the given path

Parameters:
path - path of the file to create
Throws:
TIoException - error in creating the file

deleteFile

void deleteFile(TPath path)
                throws TIoException
Throws:
TIoException

dirExists

boolean dirExists(TPath path)

createDir

void createDir(TPath path)
               throws TIoException
Throws:
TIoException

list

PathContent list(TPath path)
                 throws TIoException
List the content of the path

Parameters:
path - path
Returns:
path content, which contains a list of paths for the files and a list of paths for the directories
Throws:
TIoException - exception from the system. For example, when a direcotry does not exist, a physical system will throw the exception

createInputStream

java.io.InputStream createInputStream(TPath path)
                                      throws TIoException
Throws:
TIoException

createOutputStream

java.io.OutputStream createOutputStream(TPath path,
                                        OutputMode mode)
                                        throws TIoException
Throws:
TIoException

createOutputChannel

java.nio.channels.FileChannel createOutputChannel(TPath path,
                                                  java.io.OutputStream outputStream)
                                                  throws TIoException
Throws:
TIoException

deleteDirectory

void deleteDirectory(TPath path)
                     throws TIoException
Throws:
TIoException

moveFile

void moveFile(TPath source,
              TPath destination)
              throws TIoException
Throws:
TIoException

moveDirectory

void moveDirectory(TPath source,
                   TPath destination)
                   throws TIoException
Throws:
TIoException

pathString

java.lang.String pathString(TPath path)

fileLength

long fileLength(TPath path)

toJavaFile

java.io.File toJavaFile(TPath path)

toCanonicalPath

java.lang.String toCanonicalPath(TPath path)

createInputChannel

java.nio.channels.FileChannel createInputChannel(TPath path)
                                                 throws TIoException
Throws:
TIoException

fileLastModified

long fileLastModified(TPath path)

compare

int compare(TPath path1,
            TPath path2)
Compares the two path

Parameters:
path1 - path one
path2 - path two
Returns:
the comparing result used for sort

equals

boolean equals(TPath path1,
               TPath path2)
Check if two paths are equal. This is needed for cases like on Windows system "c:\a\b\c.txt" is the same as "C:\A\B\C.TXT" even though the case is different

Parameters:
path1 - path one
path2 - path two
Returns:
true if the two paths are equal according to the file system

hashCode

int hashCode(TPath path)
Returns the hash code for the path

Parameters:
path - path
Returns:
hash code