com.groovyj.filesystem
Class Filesystem

java.lang.Object
  |
  +--com.groovyj.filesystem.Filesystem

public class Filesystem
extends java.lang.Object

Filesystem is a minifilesystem where you can store records (files), with deleted space being managed somewhat efficiently. It's particularly useful when your record size is less than about 10k, generally on the order of 100 bytes, and they are subject to getting deleted all the time.

Got a comment about this class? Found a bug? Got an enhancement? Just want to say hi? Visit the Groovy Java Filesystem Project Home Page.

Visit the Groovy Java Home Page for information about other Groovy Java open source projects.

This class is covered by the GNU General Public License (GPL).

Version:
1.0, 8 September 1999
Author:
Robert Baruch (groovyjava@xoommail.com)

Inner Class Summary
 class Filesystem.File
          Filesystem.File is a class containing all the operations you can do to a file in the Filesystem.
 
Constructor Summary
Filesystem(java.lang.String name)
          Creates a new Filesystem or opens an existing one.
 
Method Summary
 void close()
          Closes this filesystem
 long length()
          Returns the number of bytes in this filesystem.
static void main(java.lang.String[] args)
          Runs a bunch of tests.
 Filesystem.File open()
          Opens a new file in the filesystem.
 Filesystem.File open(long offset)
          Opens an existing file in the filesystem, given the offset into the filesystem at which the file begins.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Filesystem

public Filesystem(java.lang.String name)
           throws java.io.IOException
Creates a new Filesystem or opens an existing one.
Method Detail

length

public long length()
            throws java.io.IOException
Returns the number of bytes in this filesystem.

close

public void close()
           throws java.io.IOException
Closes this filesystem
See Also:
java.io.File#close()

open

public Filesystem.File open()
                     throws java.io.IOException
Opens a new file in the filesystem.
Returns:
a Filesystem.File that must be used to access the new file.
Throws:
java.io.IOException - a new file couldn't be created.

open

public Filesystem.File open(long offset)
                     throws java.io.IOException
Opens an existing file in the filesystem, given the offset into the filesystem at which the file begins.
Parameters:
offset - the offset into the filesystem at which the file begins.
Returns:
a Filesystem.File that must be used to access the file.
Throws:
java.io.IOException - a new file couldn't be created.

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Runs a bunch of tests. I run them one at a time and then view the hex output of the resulting file to see if it makes sense.