Package weka.core.converters

# Class AbstractFileLoader

java.lang.Object
weka.core.converters.AbstractLoader
weka.core.converters.AbstractFileLoader

All Implemented Interfaces:
  `Serializable`, `FileSourcedConverter`, `Loader`, `EnvironmentHandler`, `RevisionHandler`

Direct Known Subclasses:
  `ArffLoader`, `C45Loader`, `CSVLoader`, `JSONLoader`, `LibSVMLoader`, `MatlabLoader`, `SerializedInstancesLoader`, `SVMLightLoader`, `XRFFLoader`

public abstract class AbstractFileLoader extends AbstractLoader implements FileSourcedConverter, EnvironmentHandler
Abstract superclass for all file loaders.

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

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from interface weka.core.converters.Loader

  `Loader.StructureNotReadyException`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static String`
  `FILE_EXTENSION_COMPRESSED`
  the extension for compressed files

  ### Fields inherited from interface weka.core.converters.Loader

  `BATCH, INCREMENTAL, NONE`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AbstractFileLoader()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `getUseRelativePath()`
  Gets whether relative paths are to be used
  `void`
  `reset()`
  Resets the loader ready to read a new data set
  `File`
  `retrieveFile()`
  get the File specified as the source
  `static void`
  `runFileLoader(AbstractFileLoader loader, String[] options)`
  runs the given loader with the provided options
  `void`
  `setEnvironment(Environment env)`
  Set the environment variables to use.
  `void`
  `setFile(File file)`
  sets the source File
  `void`
  `setSource(File file)`
  Resets the Loader object and sets the source of the data set to be the supplied File object.
  `void`
  `setUseRelativePath(boolean rp)`
  Set whether to use relative rather than absolute paths
  `String`
  `useRelativePathTipText()`
  Tip text suitable for displaying int the GUI

  ### Methods inherited from class weka.core.converters.AbstractLoader

  `getDataSet, getNextInstance, getStructure, setRetrieval, 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`

  ### Methods inherited from interface weka.core.RevisionHandler

  `getRevision`

- ## Field Details

  - ### FILE_EXTENSION_COMPRESSED

    public static String FILE_EXTENSION_COMPRESSED
    the extension for compressed files

- ## Constructor Details

  - ### AbstractFileLoader

    public AbstractFileLoader()

- ## Method Details

  - ### retrieveFile

    public File retrieveFile()
    get the File specified as the source
    Specified by:
      `retrieveFile` in interface `FileSourcedConverter`
    Returns:
      the source file

  - ### setFile

    public void setFile(File file) throws IOException
    sets the source File
    Specified by:
      `setFile` in interface `FileSourcedConverter`
    Parameters:
      `file` - the source file
    Throws:
      `IOException` - if an error occurs

  - ### setEnvironment

    public void setEnvironment(Environment env)
    Set the environment variables to use.
    Specified by:
      `setEnvironment` in interface `EnvironmentHandler`
    Parameters:
      `env` - the environment variables to use

  - ### reset

    public void reset() throws IOException
    Resets the loader ready to read a new data set
    Specified by:
      `reset` in interface `Loader`
    Overrides:
      `reset` in class `AbstractLoader`
    Throws:
      `IOException` - if something goes wrong

  - ### setSource

    public void setSource(File file) throws 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:
      `IOException` - if an error occurs

  - ### useRelativePathTipText

    public String useRelativePathTipText()
    Tip text suitable for displaying int the GUI
    Returns:
      a description of this property as a String

  - ### setUseRelativePath

    public void setUseRelativePath(boolean rp)
    Set whether to use relative rather than absolute paths
    Specified by:
      `setUseRelativePath` in interface `FileSourcedConverter`
    Parameters:
      `rp` - true if relative paths are to be used

  - ### getUseRelativePath

    public boolean getUseRelativePath()
    Gets whether relative paths are to be used
    Specified by:
      `getUseRelativePath` in interface `FileSourcedConverter`
    Returns:
      true if relative paths are to be used

  - ### runFileLoader

    public static void runFileLoader(AbstractFileLoader loader, 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