The Encog Project

org.encog.persist.location
Class FilePersistence

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

public class FilePersistence
extends java.lang.Object
implements PersistenceLocation

A persistence location based on a file.

Author:
jheaton

Constructor Summary
FilePersistence(java.io.File file)
          Construct a persistance location based on a file.
 
Method Summary
 java.io.InputStream createInputStream()
           
 java.io.OutputStream createOutputStream()
           
 void delete()
          Attempt to delete the file.
 boolean exists()
           
 java.io.File getFile()
           
 void renameTo(PersistenceLocation toLocation)
          Rename this file to a different location.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FilePersistence

public FilePersistence(java.io.File file)
Construct a persistance location based on a file.

Parameters:
file - The file to use.
Method Detail

createInputStream

public java.io.InputStream createInputStream()
Specified by:
createInputStream in interface PersistenceLocation
Returns:
A new InputStream for this file.

createOutputStream

public java.io.OutputStream createOutputStream()
Specified by:
createOutputStream in interface PersistenceLocation
Returns:
A new OutputStream for this file.

delete

public void delete()
Attempt to delete the file.

Specified by:
delete in interface PersistenceLocation

exists

public boolean exists()
Specified by:
exists in interface PersistenceLocation
Returns:
True if the file exists.

getFile

public java.io.File getFile()
Returns:
The file this location is based on.

renameTo

public void renameTo(PersistenceLocation toLocation)
Rename this file to a different location.

Specified by:
renameTo in interface PersistenceLocation
Parameters:
toLocation - What to rename to.

The Encog Project