public class ArffLoader extends AbstractFileLoader implements BatchConverter, IncrementalConverter, URLSourcedLoader
Loader,
Serialized Form| Modifier and Type | Class and Description |
|---|---|
static class |
ArffLoader.ArffReader
Reads data from an ARFF file, either in incremental or batch mode.
|
Loader.StructureNotReadyException| Modifier and Type | Field and Description |
|---|---|
static String |
FILE_EXTENSION
the file extension
|
static String |
FILE_EXTENSION_COMPRESSED |
BATCH, INCREMENTAL, NONE| Constructor and Description |
|---|
ArffLoader() |
| Modifier and Type | Method and Description |
|---|---|
Instances |
getDataSet()
Return the full data set.
|
String |
getFileDescription()
Returns a description of the file type.
|
String |
getFileExtension()
Get the file extension used for arff files
|
String[] |
getFileExtensions()
Gets all the file extensions used for this type of file
|
Instance |
getNextInstance(Instances structure)
Read the data set incrementally---get the next instance in the data set or
returns null if there are no more instances to get.
|
boolean |
getRetainStringVals()
Get whether to retain the values of string attributes in memory (in the
header) when reading incrementally.
|
String |
getRevision()
Returns the revision string.
|
Instances |
getStructure()
Determines and returns (if possible) the structure (internally the header)
of the data set as an empty set of instances.
|
String |
globalInfo()
Returns a string describing this Loader
|
static void |
main(String[] args)
Main method.
|
void |
reset()
Resets the Loader ready to read a new data set or the same data set again.
|
String |
retainStringValsTipText()
Tool tip text for this property
|
File |
retrieveFile()
get the File specified as the source
|
String |
retrieveURL()
Return the current url
|
void |
setFile(File file)
sets the source File
|
void |
setRetainStringVals(boolean retain)
Set whether to retain the values of string attributes in memory (in the
header) when reading incrementally.
|
void |
setSource(InputStream in)
Resets the Loader object and sets the source of the data set to be the
supplied InputStream.
|
void |
setSource(URL url)
Resets the Loader object and sets the source of the data set to be the
supplied url.
|
void |
setURL(String url)
Set the url to load from
|
getUseRelativePath, runFileLoader, setEnvironment, setSource, setUseRelativePath, useRelativePathTipTextsetRetrievalpublic static String FILE_EXTENSION
public static String FILE_EXTENSION_COMPRESSED
public String globalInfo()
public String retainStringValsTipText()
public void setRetainStringVals(boolean retain)
retain - true if string values are to be retained in memory when
reading incrementallypublic boolean getRetainStringVals()
public String getFileExtension()
getFileExtension in interface FileSourcedConverterpublic String[] getFileExtensions()
getFileExtensions in interface FileSourcedConverterpublic String getFileDescription()
getFileDescription in interface FileSourcedConverterpublic void reset()
throws IOException
reset in interface Loaderreset in class AbstractFileLoaderIOException - if something goes wrongpublic void setSource(URL url) throws IOException
url - the source url.IOException - if an error occurspublic File retrieveFile()
retrieveFile in interface FileSourcedConverterretrieveFile in class AbstractFileLoaderpublic void setFile(File file) throws IOException
setFile in interface FileSourcedConvertersetFile in class AbstractFileLoaderfile - the source fileIOException - if an error occurspublic void setURL(String url) throws IOException
setURL in interface URLSourcedLoaderurl - the url to load fromIOException - if the url can't be set.public String retrieveURL()
retrieveURL in interface URLSourcedLoaderpublic void setSource(InputStream in) throws IOException
setSource in interface LoadersetSource in class AbstractLoaderin - the source InputStream.IOException - always thrown.public Instances getStructure() throws IOException
getStructure in interface LoadergetStructure in class AbstractLoaderIOException - if an error occurspublic Instances getDataSet() throws IOException
getDataSet in interface LoadergetDataSet in class AbstractLoaderIOException - if there is no source or parsing failspublic Instance getNextInstance(Instances structure) throws IOException
getNextInstance in interface LoadergetNextInstance in class AbstractLoaderstructure - the dataset header information, will get updated in case
of string or relational attributesIOException - if there is an error during parsingpublic String getRevision()
getRevision in interface RevisionHandlerpublic static void main(String[] args)
args - should contain the name of an input file.Copyright © 2014 University of Waikato, Hamilton, NZ. All Rights Reserved.