org.encog.persist
Class EncogDirectoryPersistence

java.lang.Object
  extended by org.encog.persist.EncogDirectoryPersistence

public class EncogDirectoryPersistence
extends Object

Handles Encog persistence for a directory. This is the usual mode where each resource is stored in a separate EG file.


Constructor Summary
EncogDirectoryPersistence(File parent)
          Construct the object.
 
Method Summary
 String getEncogType(String name)
          Get the type of an Encog object in an EG file, without the need to read the entire file.
 File getParent()
           
 Object loadFromDirectory(String name)
          Load a file from the directory that this object refers to.
static Object loadObject(File file)
          Load the specified object.
static Object loadObject(InputStream is)
          Load an object from an input stream.
static Object loadResourceObject(String res)
          Load an EG object as a reousrce.
static void saveObject(File filename, Object obj)
          Save the specified object.
static void saveObject(OutputStream os, Object obj)
          Save the specified object.
 void saveToDirectory(String name, Object obj)
          Save a file to the directory that this object refers to.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EncogDirectoryPersistence

public EncogDirectoryPersistence(File parent)
Construct the object.

Parameters:
parent - The directory to use.
Method Detail

loadResourceObject

public static Object loadResourceObject(String res)
Load an EG object as a reousrce.

Parameters:
res - The resource name.
Returns:
The loaded object.

loadObject

public static Object loadObject(File file)
Load the specified object.

Parameters:
file - The file to load.
Returns:
The loaded object.

loadObject

public static Object loadObject(InputStream is)
Load an object from an input stream.

Parameters:
is - The input stream to read from.
Returns:
The loaded object.

saveObject

public static void saveObject(File filename,
                              Object obj)
Save the specified object.

Parameters:
filename - The filename to save to.
obj - The Object to save.

saveObject

public static void saveObject(OutputStream os,
                              Object obj)
Save the specified object.

Parameters:
os - The output stream to write to.
obj - The object to save.

getEncogType

public String getEncogType(String name)
Get the type of an Encog object in an EG file, without the need to read the entire file.

Parameters:
name - The filename to read.
Returns:
The type.

getParent

public final File getParent()
Returns:
The directory.

loadFromDirectory

public final Object loadFromDirectory(String name)
Load a file from the directory that this object refers to.

Parameters:
name - The name to load.
Returns:
The object.

saveToDirectory

public final void saveToDirectory(String name,
                                  Object obj)
Save a file to the directory that this object refers to.

Parameters:
name - The name to load.


Copyright © 2014. All Rights Reserved.