things.thinger.io
Interface AFileSystem

All Known Implementing Classes:
FSFileSystem

public interface AFileSystem

Abstract File System Interface. This is not meant to replace the Universes. I regret the necessity of this, but it would take me a long time to implement everything I need in the universes just so I can get the kernel up.

Version:
1.0

Version History

EPG - Initial - 20 FEB 05
 
Author:
Erich P. Gatejen

Field Summary
static java.lang.String ROOT
          This is the assumed mount root for any filesystem.
 
Method Summary
 boolean copy(java.lang.String path, java.io.InputStream is)
          Copy an InputStream to a file designated by the path.
 boolean delete(java.lang.String path, boolean recurse)
          Delete a file or directory if it exists at the path given.
 java.lang.String describeRoot()
          Describe the root to this filesystem.
 boolean exists(java.lang.String path)
          Report if a file exists at the path given.
 boolean isDirectory(java.lang.String path)
          Is this a directory?
 boolean isFile(java.lang.String path)
          Is this a file?
 void mkdir(java.lang.String path)
          Make the directory.
 java.io.InputStream openInputStream(java.lang.String path)
          Open a file with an InputStream for input.
 java.io.OutputStream openOutputStream(java.lang.String path)
          Open a file with an OutputStream for output
 java.util.List<java.lang.String> paths(java.lang.String path)
          Paths within the given root path.
 long size(java.lang.String path)
          Current size of the file.
 

Field Detail

ROOT

static final java.lang.String ROOT
This is the assumed mount root for any filesystem.

See Also:
Constant Field Values
Method Detail

describeRoot

java.lang.String describeRoot()
Describe the root to this filesystem. It may be an empty String.

Returns:
A textual description for the root.

exists

boolean exists(java.lang.String path)
Report if a file exists at the path given.

Parameters:
path - The path
Returns:
True if the file exists, otherwise false.

size

long size(java.lang.String path)
Current size of the file. It can change.

Parameters:
path - The path
Returns:
the size or 0 if the file doesn't exist or is invalid.

delete

boolean delete(java.lang.String path,
               boolean recurse)
               throws SystemException
Delete a file or directory if it exists at the path given.

Parameters:
path - An absolute path to the item.
recurse - If set true, it will delete sub-directories on a directory delete, otherwise it will just delete the files.
Returns:
true if the file existed, otherwise false.
Throws:
things.common.SystemException
SystemException

isFile

boolean isFile(java.lang.String path)
Is this a file?

Parameters:
path - The path
Returns:
True if is a file, otherwise false.

isDirectory

boolean isDirectory(java.lang.String path)
Is this a directory?

Parameters:
path - The path
Returns:
True if is a director, otherwise false.

paths

java.util.List<java.lang.String> paths(java.lang.String path)
                                       throws SystemException
Paths within the given root path. It's how to find a directories contents.

Returns:
An array of paths as Strings or null if the path is invalid.
Throws:
things.common.SystemException
SystemException

copy

boolean copy(java.lang.String path,
             java.io.InputStream is)
             throws SystemException
Copy an InputStream to a file designated by the path. It'll throw a ThingsException if something goes wrong. It will return true if it overwrote an existing file.

Parameters:
path - The path to the destination. If the file exists, it will be overwritten. If the path does not exist, it will be created.
is - An InputStream to the source. It should be buffered, so don't bother doing it.
Returns:
true if it overwrote a file, otherwise false
Throws:
things.common.SystemException
SystemException

openInputStream

java.io.InputStream openInputStream(java.lang.String path)
                                    throws SystemException
Open a file with an InputStream for input.

Parameters:
path - The past to the file to open.
Returns:
An InputStream that can read from the file.
Throws:
things.common.SystemException
SystemException

openOutputStream

java.io.OutputStream openOutputStream(java.lang.String path)
                                      throws SystemException
Open a file with an OutputStream for output

Parameters:
path - The past to the file to open.
Returns:
An OutputStream that can read from the file.
Throws:
things.common.SystemException
SystemException

mkdir

void mkdir(java.lang.String path)
           throws SystemException
Make the directory. If it already exists, nothing will happen. It will make all directories neccessary to finish the job.

Parameters:
path - The past to the file to open.
Throws:
things.common.SystemException
SystemException


Things.