org.encog.persist.location
Class ResourcePersistence

java.lang.Object
  extended by org.encog.persist.location.ResourcePersistence
All Implemented Interfaces:
PersistenceLocation

public class ResourcePersistence
extends Object
implements PersistenceLocation

A location that allows Encog objects to be read from a resource. This location only supports read operations, so the Encog resource is usually created first as a file and then embedded in the application as a resource. An example of the format for a file stored this way is: org/encog/data/classes.txt


Constructor Summary
ResourcePersistence(String resource)
          Construct a location to read from the specified resource.
 
Method Summary
 InputStream createInputStream()
          Create an input stream to read from the resource.
 OutputStream createOutputStream()
          Write operations are not supported for resource persistence.
 void delete()
          Delete operations are not supported for resource persistence.
 boolean exists()
          Exist is not supported for resource persistence.
 String loadString()
          Load the resource as a string.
 void renameTo(PersistenceLocation toLocation)
          Rename is not supported for resource persistence.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourcePersistence

public ResourcePersistence(String resource)
Construct a location to read from the specified resource. An example of the format for a file stored this way is: org/encog/data/classes.txt

Parameters:
resource - The resource to read from.
Method Detail

createInputStream

public InputStream createInputStream()
Create an input stream to read from the resource.

Specified by:
createInputStream in interface PersistenceLocation
Returns:
An input stream.

createOutputStream

public OutputStream createOutputStream()
Write operations are not supported for resource persistence.

Specified by:
createOutputStream in interface PersistenceLocation
Returns:
Nothing.

delete

public void delete()
Delete operations are not supported for resource persistence.

Specified by:
delete in interface PersistenceLocation

exists

public boolean exists()
Exist is not supported for resource persistence.

Specified by:
exists in interface PersistenceLocation
Returns:
Nothing.

renameTo

public void renameTo(PersistenceLocation toLocation)
Rename is not supported for resource persistence.

Specified by:
renameTo in interface PersistenceLocation
Parameters:
toLocation - Not used.

loadString

public String loadString()
Load the resource as a string.

Returns:
The resource as a string.


Copyright © 2011. All Rights Reserved.