org.axiondb.io
Class AxionFileSystem

java.lang.Object
  extended by org.axiondb.io.AxionFileSystem

public class AxionFileSystem
extends java.lang.Object

Axion File System, creates file input/output streams and wraps then into a custom BufferedDataStream, which improves perfermance significantly.

Version:
$Revision: 1.8 $ $Date: 2005/12/20 18:32:58 $

Nested Class Summary
 class AxionFileSystem.PidxList
           
 
Constructor Summary
AxionFileSystem()
           
 
Method Summary
 void closeInputStream(java.io.InputStream in)
           
 void closeOutputStream(java.io.OutputStream out)
           
 BufferedDataOutputStream createBufferedDOS(java.io.File file)
          create a new file and wrap wrap the stream with BufferedDataOutputStream which improves perfermance significantly.
 java.io.DataOutputStream createDataOutputSteam(java.io.File file)
           
 boolean createNewFile(java.io.File file)
           
 java.io.ObjectOutputStream createObjectOutputSteam(java.io.File file)
           
 AxionFileSystem.PidxList newPidxList(int count, java.io.File file, boolean readonly)
           
 AxionInputStream open(java.io.File file)
          Open the file in read only mode.
 AxionOutputStream open(java.io.File file, boolean overwrite)
          Open file in append mode if overwrite is false, otherwise create new file.
 AxionOutputStream openAppend(java.io.File file)
          Open file in append mode, position will be set to the end of file.
 BufferedDataInputStream openBufferedDIS(java.io.File file)
          Open file in read only mode, position will be set to 0.
 BufferedDataOutputStream openBufferedDOS(java.io.File file, long startPos)
          Open a outputsteam and points the file pointer to a given start position in the file.
 BufferedDataOutputStream openBufferedDOSAppend(java.io.File file, int bufferSize)
          Open file in append mode, position will be set to the end of file.
 java.io.DataInputStream openDataInputSteam(java.io.File file)
           
 java.io.ObjectInputStream openObjectInputSteam(java.io.File file)
           
 org.apache.commons.collections.primitives.IntList parseIntFile(java.io.File file)
          Reads a list of int values from a file.
 AxionFileSystem.PidxList parseLongPidx(java.io.File file, boolean readOnly)
          Reads a list of long values from a file.
 AxionFileSystem.PidxList parseUnsignedIntPidx(java.io.File file, boolean readOnly)
           
 void readAll(java.io.File file, byte[] rawdata)
           
 void writeIntFile(java.io.File file, org.apache.commons.collections.primitives.IntList list)
          Writes a list of int values to a file.
 void writeUnsignedInt(BufferedDataOutputStream out, long offset, int value)
          Updates an UnsignedInt value to a file.
 void writeUnsignedIntFile(java.io.File file, org.apache.commons.collections.primitives.LongList list)
          Writes a list of long values to a file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AxionFileSystem

public AxionFileSystem()
Method Detail

closeInputStream

public void closeInputStream(java.io.InputStream in)

closeOutputStream

public void closeOutputStream(java.io.OutputStream out)

createBufferedDOS

public BufferedDataOutputStream createBufferedDOS(java.io.File file)
                                           throws AxionException
create a new file and wrap wrap the stream with BufferedDataOutputStream which improves perfermance significantly.

Throws:
AxionException

createNewFile

public boolean createNewFile(java.io.File file)
                      throws AxionException
Throws:
AxionException

createObjectOutputSteam

public java.io.ObjectOutputStream createObjectOutputSteam(java.io.File file)
                                                   throws java.io.IOException
Throws:
java.io.IOException

createDataOutputSteam

public java.io.DataOutputStream createDataOutputSteam(java.io.File file)
                                               throws java.io.IOException
Throws:
java.io.IOException

newPidxList

public AxionFileSystem.PidxList newPidxList(int count,
                                            java.io.File file,
                                            boolean readonly)
                                     throws AxionException
Throws:
AxionException

open

public AxionInputStream open(java.io.File file)
                      throws java.io.IOException
Open the file in read only mode.

Throws:
java.io.IOException

open

public AxionOutputStream open(java.io.File file,
                              boolean overwrite)
                       throws java.io.IOException
Open file in append mode if overwrite is false, otherwise create new file.

Throws:
java.io.IOException

openAppend

public AxionOutputStream openAppend(java.io.File file)
                             throws java.io.IOException
Open file in append mode, position will be set to the end of file. Creates the file if does not exist yet.

Throws:
java.io.IOException

openBufferedDIS

public BufferedDataInputStream openBufferedDIS(java.io.File file)
                                        throws AxionException
Open file in read only mode, position will be set to 0. seek can be used to perferm random access. This will wrap the stream with BufferedDataInputStream which improves perfermance significantly.

Throws:
AxionException

openBufferedDOS

public BufferedDataOutputStream openBufferedDOS(java.io.File file,
                                                long startPos)
                                         throws AxionException
Open a outputsteam and points the file pointer to a given start position in the file.

Throws:
AxionException

openBufferedDOSAppend

public BufferedDataOutputStream openBufferedDOSAppend(java.io.File file,
                                                      int bufferSize)
                                               throws AxionException
Open file in append mode, position will be set to the end of file. Creates the file if does not exist yet. This will wrap the stream with BufferedDataOutputStream which improves perfermance significantly.

Throws:
AxionException

openObjectInputSteam

public java.io.ObjectInputStream openObjectInputSteam(java.io.File file)
                                               throws java.io.IOException
Throws:
java.io.IOException

openDataInputSteam

public java.io.DataInputStream openDataInputSteam(java.io.File file)
                                           throws java.io.IOException
Throws:
java.io.IOException

parseIntFile

public org.apache.commons.collections.primitives.IntList parseIntFile(java.io.File file)
                                                               throws AxionException
Reads a list of int values from a file.

Parameters:
file - the Fileto read from
Throws:
AxionException

parseLongPidx

public AxionFileSystem.PidxList parseLongPidx(java.io.File file,
                                              boolean readOnly)
                                       throws AxionException
Reads a list of long values from a file.

Parameters:
file - the Fileto read from
Throws:
AxionException

parseUnsignedIntPidx

public AxionFileSystem.PidxList parseUnsignedIntPidx(java.io.File file,
                                                     boolean readOnly)
                                              throws AxionException
Throws:
AxionException

readAll

public void readAll(java.io.File file,
                    byte[] rawdata)
             throws AxionException
Throws:
AxionException

writeIntFile

public void writeIntFile(java.io.File file,
                         org.apache.commons.collections.primitives.IntList list)
                  throws AxionException
Writes a list of int values to a file.

Parameters:
file - the Fileto write to
Throws:
AxionException

writeUnsignedInt

public void writeUnsignedInt(BufferedDataOutputStream out,
                             long offset,
                             int value)
                      throws AxionException
Updates an UnsignedInt value to a file.

Parameters:
raf - the Fileto append to
offset - the pidx file offset to write
value - data file pointer for a given pidx offset
Throws:
AxionException

writeUnsignedIntFile

public void writeUnsignedIntFile(java.io.File file,
                                 org.apache.commons.collections.primitives.LongList list)
                          throws AxionException
Writes a list of long values to a file.

Parameters:
file - the Fileto write to
Throws:
AxionException