com.partnersoft.formats.tof
Class TofLib

java.lang.Object
  extended by com.partnersoft.formats.tof.TofLib
All Implemented Interfaces:
Lib

public class TofLib
extends java.lang.Object
implements Lib

Convenience library for loading and saving via the TOF format.

Copyright 2008 Partner Software, Inc.

Version:
$Id$
Author:
Paul Reavis

Method Summary
static java.lang.Object cloneUsingTof(java.lang.Object original)
          This is a slow-but-very-sure cloning method based on writing the object out as a TOF and reading it back in again.
static java.lang.Object readMetaObjectFrom(VfsFile file)
          Reads the TOF file and converts the result to an MetaTOF object.
static java.lang.Object readObjectFrom(VfsFile file)
          Reads the TOF file and converts the result to an appropriate object.
static boolean validate(VfsFile file)
          Parses and validates the syntax for the given TOF file.
static void writeMetaObjectTo(java.lang.Object object, VfsFile file)
          Writes the given object in TOF format to the given file.
static void writeObjectTo(java.lang.Object object, VfsFile file)
          Writes the given object in TOF format to the given file.
static void writeObjectWithoutPointersTo(java.lang.Object victim, VfsFile tofFile)
          Writes an object to in TOF format to the given file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

readObjectFrom

public static java.lang.Object readObjectFrom(VfsFile file)
                                       throws java.io.IOException
Reads the TOF file and converts the result to an appropriate object.

Throws:
java.io.IOException

writeObjectTo

public static void writeObjectTo(java.lang.Object object,
                                 VfsFile file)
                          throws java.io.IOException
Writes the given object in TOF format to the given file.

Throws:
java.io.IOException

writeObjectWithoutPointersTo

public static void writeObjectWithoutPointersTo(java.lang.Object victim,
                                                VfsFile tofFile)
                                         throws java.io.IOException
Writes an object to in TOF format to the given file. Doesn't use pointers (so can't do circular or complex relationships, but is easier to read/modify by hand).

Throws:
java.io.IOException

readMetaObjectFrom

public static java.lang.Object readMetaObjectFrom(VfsFile file)
                                           throws java.io.IOException
Reads the TOF file and converts the result to an MetaTOF object.

Throws:
java.io.IOException

writeMetaObjectTo

public static void writeMetaObjectTo(java.lang.Object object,
                                     VfsFile file)
                              throws java.io.IOException
Writes the given object in TOF format to the given file.

Throws:
java.io.IOException

validate

public static boolean validate(VfsFile file)
                        throws java.io.IOException
Parses and validates the syntax for the given TOF file.

Parameters:
file -
Throws:
java.io.IOException

cloneUsingTof

public static java.lang.Object cloneUsingTof(java.lang.Object original)
                                      throws java.io.IOException
This is a slow-but-very-sure cloning method based on writing the object out as a TOF and reading it back in again. This should prevent any kind of lingering pointers from within the structure.

Throws:
java.io.IOException