net.metanotion.io
Class ChRootFileSystem

java.lang.Object
  extended by net.metanotion.io.ChRootFileSystem
All Implemented Interfaces:
FileSystem, JFileSystem

public final class ChRootFileSystem
extends Object
implements JFileSystem

FileSystem to change the root of another file system.


Constructor Summary
ChRootFileSystem(JFileSystem fs, String root)
          Create a changed root file system.
 
Method Summary
 void addListener(FileSystemListener fsl)
          Add a listener to this file system.
 void addListener(FileSystemListener fsl, File root)
          Add a listener to this file system.
 void addListener(FileSystemListener fsl, File root, boolean recursive)
          Add a listener to this file system.
 File getFile(String url)
          Get the file corresponding to a url.
 File getRoot()
          Get the root File object of this file system.
 InputStream openInput(File f)
          Get an input stream to read a file.
 InputStream openJInput(File f)
          Get a Java intput stream to write a file.
 OutputStream openJOutput(File f)
          Get a Java output stream to write a file.
 RandomAccessFile openJRandomAccess(File f)
          Get a random access to read and write a file.
 OutputStream openOutput(File f)
          Get an output stream to write a file.
 RandomAccess openRandomAccess(File f)
          Open a file for reading and writing.
 void removeListener(FileSystemListener fsl)
          Remove a listener to this file system.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChRootFileSystem

public ChRootFileSystem(JFileSystem fs,
                        String root)
Create a changed root file system.

Parameters:
fs - FileSystem to change the root of.
root - New root file filename.
Method Detail

getRoot

public File getRoot()
Description copied from interface: FileSystem
Get the root File object of this file system.

Specified by:
getRoot in interface FileSystem
Returns:
Root file.

getFile

public File getFile(String url)
Description copied from interface: FileSystem
Get the file corresponding to a url.

Specified by:
getFile in interface FileSystem
Parameters:
url - filename of the file or directory.
Returns:
File object corresponding to a url.

openInput

public InputStream openInput(File f)
Description copied from interface: FileSystem
Get an input stream to read a file.

Specified by:
openInput in interface FileSystem
Parameters:
f - File to open for reading.
Returns:
InputStream to read the file.

openOutput

public OutputStream openOutput(File f)
Description copied from interface: FileSystem
Get an output stream to write a file.

Specified by:
openOutput in interface FileSystem
Parameters:
f - File to open for writing.
Returns:
OutputStream to write the file.

openRandomAccess

public RandomAccess openRandomAccess(File f)
Description copied from interface: FileSystem
Open a file for reading and writing.

Specified by:
openRandomAccess in interface FileSystem
Parameters:
f - File to open.
Returns:
RandomAccess object to read and write the file.

addListener

public void addListener(FileSystemListener fsl)
Description copied from interface: FileSystem
Add a listener to this file system.

Specified by:
addListener in interface FileSystem
Parameters:
fsl - FileSystemListner to call back.

addListener

public void addListener(FileSystemListener fsl,
                        File root)
Description copied from interface: FileSystem
Add a listener to this file system.

Specified by:
addListener in interface FileSystem
Parameters:
fsl - FileSystemListner to call back
root - File or directory to specifically watch.

addListener

public void addListener(FileSystemListener fsl,
                        File root,
                        boolean recursive)
Description copied from interface: FileSystem
Add a listener to this file system.

Specified by:
addListener in interface FileSystem
Parameters:
fsl - FileSystemListner to call back
root - File or directory to specifically watch.
recursive - If true, send events for all children of this file, if false, only events on this file.

removeListener

public void removeListener(FileSystemListener fsl)
Description copied from interface: FileSystem
Remove a listener to this file system.

Specified by:
removeListener in interface FileSystem
Parameters:
fsl - FileSystemListner to remove.

openJInput

public InputStream openJInput(File f)
Description copied from interface: JFileSystem
Get a Java intput stream to write a file.

Specified by:
openJInput in interface JFileSystem
Parameters:
f - File to open for reading.
Returns:
InputStream to read the file.

openJOutput

public OutputStream openJOutput(File f)
Description copied from interface: JFileSystem
Get a Java output stream to write a file.

Specified by:
openJOutput in interface JFileSystem
Parameters:
f - File to open for writing.
Returns:
OutputStream to write the file.

openJRandomAccess

public RandomAccessFile openJRandomAccess(File f)
Description copied from interface: JFileSystem
Get a random access to read and write a file.

Specified by:
openJRandomAccess in interface JFileSystem
Parameters:
f - File to open.
Returns:
RandomAccessFile to read and write the file.