weka.core.converters
Class AbstractFileLoader

java.lang.Object
  extended by weka.core.converters.AbstractLoader
      extended by weka.core.converters.AbstractFileLoader
All Implemented Interfaces:
java.io.Serializable, FileSourcedConverter, Loader
Direct Known Subclasses:
ArffLoader, C45Loader, CSVLoader, LibSVMLoader, SerializedInstancesLoader, XRFFLoader

public abstract class AbstractFileLoader
extends AbstractLoader
implements FileSourcedConverter

Abstract superclass for all file loaders.

Version:
$Revision: 1.2 $
Author:
fracpete (fracpete at waikato dot ac dot nz)
See Also:
Serialized Form

Constructor Summary
AbstractFileLoader()
           
 
Method Summary
 void reset()
          Resets the loader ready to read a new data set
 java.io.File retrieveFile()
          get the File specified as the source
static void runFileLoader(AbstractFileLoader loader, java.lang.String[] options)
          runs the given loader with the provided options
 void setFile(java.io.File file)
          sets the source File
 void setSource(java.io.File file)
          Resets the Loader object and sets the source of the data set to be the supplied File object.
 
Methods inherited from class weka.core.converters.AbstractLoader
getDataSet, getNextInstance, getStructure, setSource
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface weka.core.converters.FileSourcedConverter
getFileDescription, getFileExtension, getFileExtensions
 

Constructor Detail

AbstractFileLoader

public AbstractFileLoader()
Method Detail

retrieveFile

public java.io.File retrieveFile()
get the File specified as the source

Specified by:
retrieveFile in interface FileSourcedConverter
Returns:
the source file

setFile

public void setFile(java.io.File file)
             throws java.io.IOException
sets the source File

Specified by:
setFile in interface FileSourcedConverter
Parameters:
file - the source file
Throws:
java.io.IOException - if an error occurs

reset

public void reset()
           throws java.io.IOException
Resets the loader ready to read a new data set

Specified by:
reset in interface Loader
Overrides:
reset in class AbstractLoader
Throws:
java.io.IOException - if something goes wrong

setSource

public void setSource(java.io.File file)
               throws java.io.IOException
Resets the Loader object and sets the source of the data set to be the supplied File object.

Specified by:
setSource in interface Loader
Overrides:
setSource in class AbstractLoader
Parameters:
file - the source file.
Throws:
java.io.IOException - if an error occurs

runFileLoader

public static void runFileLoader(AbstractFileLoader loader,
                                 java.lang.String[] options)
runs the given loader with the provided options

Parameters:
loader - the loader to run
options - the commandline options, first argument must be the file to load