Package weka.core.converters

# Class ConverterUtils

java.lang.Object
weka.core.converters.ConverterUtils

All Implemented Interfaces:
  `Serializable`, `RevisionHandler`

public class ConverterUtils extends Object implements Serializable, RevisionHandler
Utility routines for the converter package.

Version:
  $Revision: 15666 $
Author:
  Mark Hall (mhall@cs.waikato.ac.nz), FracPete (fracpete at waikato dot ac dot nz)
See Also:
  - `Serializable`
  - Serialized Form

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static class`
  `ConverterUtils.DataSink`
  Helper class for saving data to files.
  `static class`
  `ConverterUtils.DataSource`
  Helper class for loading data from files and URLs.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ConverterUtils()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static void`
  `errms(StreamTokenizer tokenizer, String theMsg)`
  Throws error message with line number and last token read.
  `static Vector<String>`
  `getFileLoaders()`
  returns a vector with the classnames of all the file loaders.
  `static Vector<String>`
  `getFileSavers()`
  returns a vector with the classnames of all the file savers.
  `static void`
  `getFirstToken(StreamTokenizer tokenizer)`
  Gets token, skipping empty lines.
  `static AbstractFileLoader`
  `getLoaderForExtension(String extension)`
  tries to determine the loader to use for this kind of extension, returns null if none can be found.
  `static AbstractFileLoader`
  `getLoaderForFile(File file)`
  tries to determine the loader to use for this kind of file, returns null if none can be found.
  `static AbstractFileLoader`
  `getLoaderForFile(String filename)`
  tries to determine the loader to use for this kind of file, returns null if none can be found.
  `static List<AbstractFileLoader>`
  `getLoadersForExtension(String extension)`
  tries to determine the loader to use for this kind of extension, returns null if none can be found.
  `static List<AbstractFileLoader>`
  `getLoadersForFile(File file)`
  tries to determine the loaders to use for this kind of file.
  `static List<AbstractFileLoader>`
  `getLoadersForFile(String filename)`
  tries to determine the loaders to use for this kind of file.
  `String`
  `getRevision()`
  Returns the revision string.
  `static AbstractFileSaver`
  `getSaverForExtension(String extension)`
  tries to determine the saver to use for this kind of extension, returns null if none can be found.
  `static AbstractFileSaver`
  `getSaverForFile(File file)`
  tries to determine the saver to use for this kind of file, returns null if none can be found.
  `static AbstractFileSaver`
  `getSaverForFile(String filename)`
  tries to determine the saver to use for this kind of file, returns null if none can be found.
  `static List<AbstractFileSaver>`
  `getSaversForExtension(String extension)`
  tries to determine the savers to use for this kind of extension.
  `static List<AbstractFileSaver>`
  `getSaversForFile(File file)`
  tries to determine the savers to use for this kind of file.
  `static List<AbstractFileSaver>`
  `getSaversForFile(String filename)`
  tries to determine the savers to use for this kind of file.
  `static void`
  `getToken(StreamTokenizer tokenizer)`
  Gets token.
  `static Vector<String>`
  `getURLFileLoaders()`
  returns a vector with the classnames of all the URL file loaders.
  `static AbstractFileLoader`
  `getURLLoaderForExtension(String extension)`
  tries to determine the URL loader to use for this kind of extension, returns null if none can be found.
  `static AbstractFileLoader`
  `getURLLoaderForFile(File file)`
  tries to determine the URL loader to use for this kind of file, returns null if none can be found.
  `static AbstractFileLoader`
  `getURLLoaderForFile(String filename)`
  tries to determine the URL loader to use for this kind of file, returns null if none can be found.
  `static List<AbstractFileLoader>`
  `getURLLoadersForExtension(String extension)`
  tries to determine the URL loaders to use for this kind of extension.
  `static List<AbstractFileLoader>`
  `getURLLoadersForFile(File file)`
  tries to determine the URL loaders to use for this kind of file.
  `static List<AbstractFileLoader>`
  `getURLLoadersForFile(String filename)`
  tries to determine the URL loader to use for this kind of file.
  `static void`
  `initialize()`

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### ConverterUtils

    public ConverterUtils()

- ## Method Details

  - ### initialize

    public static void initialize()

  - ### getFirstToken

    public static void getFirstToken(StreamTokenizer tokenizer) throws IOException
    Gets token, skipping empty lines.
    Parameters:
      `tokenizer` - the stream tokenizer
    Throws:
      `IOException` - if reading the next token fails

  - ### getToken

    public static void getToken(StreamTokenizer tokenizer) throws IOException
    Gets token.
    Parameters:
      `tokenizer` - the stream tokenizer
    Throws:
      `IOException` - if reading the next token fails

  - ### errms

    public static void errms(StreamTokenizer tokenizer, String theMsg) throws IOException
    Throws error message with line number and last token read.
    Parameters:
      `theMsg` - the error message to be thrown
      `tokenizer` - the stream tokenizer
    Throws:
      `IOException` - containing the error message

  - ### getFileLoaders

    public static Vector<String> getFileLoaders()
    returns a vector with the classnames of all the file loaders.
    Returns:
      the classnames of the loaders

  - ### getLoaderForFile

    public static AbstractFileLoader getLoaderForFile(String filename)
    tries to determine the loader to use for this kind of file, returns null if none can be found.
    Parameters:
      `filename` - the file to return a converter for
    Returns:
      the converter if one was found, null otherwise

  - ### getLoadersForFile

    public static List<AbstractFileLoader> getLoadersForFile(String filename)
    tries to determine the loaders to use for this kind of file.
    Parameters:
      `filename` - the file to return converters for
    Returns:
      the converters, list is empty if none found

  - ### getLoaderForFile

    public static AbstractFileLoader getLoaderForFile(File file)
    tries to determine the loader to use for this kind of file, returns null if none can be found.
    Parameters:
      `file` - the file to return a converter for
    Returns:
      the converter if one was found, null otherwise

  - ### getLoadersForFile

    public static List<AbstractFileLoader> getLoadersForFile(File file)
    tries to determine the loaders to use for this kind of file.
    Parameters:
      `file` - the file to return converters for
    Returns:
      the converters, empty list if none found

  - ### getLoaderForExtension

    public static AbstractFileLoader getLoaderForExtension(String extension)
    tries to determine the loader to use for this kind of extension, returns null if none can be found.
    Parameters:
      `extension` - the file extension to return a converter for
    Returns:
      the converter if one was found, null otherwise

  - ### getLoadersForExtension

    public static List<AbstractFileLoader> getLoadersForExtension(String extension)
    tries to determine the loader to use for this kind of extension, returns null if none can be found.
    Parameters:
      `extension` - the file extension to return a converter for
    Returns:
      the converter if one was found, null otherwise

  - ### getURLFileLoaders

    public static Vector<String> getURLFileLoaders()
    returns a vector with the classnames of all the URL file loaders.
    Returns:
      the classnames of the loaders

  - ### getURLLoaderForFile

    public static AbstractFileLoader getURLLoaderForFile(String filename)
    tries to determine the URL loader to use for this kind of file, returns null if none can be found.
    Parameters:
      `filename` - the file to return a URL converter for
    Returns:
      the converter if one was found, null otherwise

  - ### getURLLoadersForFile

    public static List<AbstractFileLoader> getURLLoadersForFile(String filename)
    tries to determine the URL loader to use for this kind of file.
    Parameters:
      `filename` - the file to return URL converters for
    Returns:
      the converters, empty list if none found

  - ### getURLLoaderForFile

    public static AbstractFileLoader getURLLoaderForFile(File file)
    tries to determine the URL loader to use for this kind of file, returns null if none can be found.
    Parameters:
      `file` - the file to return a URL converter for
    Returns:
      the converter if one was found, null otherwise

  - ### getURLLoadersForFile

    public static List<AbstractFileLoader> getURLLoadersForFile(File file)
    tries to determine the URL loaders to use for this kind of file.
    Parameters:
      `file` - the file to return URL converters for
    Returns:
      the converters, empty list if none found

  - ### getURLLoaderForExtension

    public static AbstractFileLoader getURLLoaderForExtension(String extension)
    tries to determine the URL loader to use for this kind of extension, returns null if none can be found.
    Parameters:
      `extension` - the file extension to return a URL converter for
    Returns:
      the converter if one was found, null otherwise

  - ### getURLLoadersForExtension

    public static List<AbstractFileLoader> getURLLoadersForExtension(String extension)
    tries to determine the URL loaders to use for this kind of extension.
    Parameters:
      `extension` - the file extension to return URL converters for
    Returns:
      the converters, empty list of none found

  - ### getFileSavers

    public static Vector<String> getFileSavers()
    returns a vector with the classnames of all the file savers.
    Returns:
      the classnames of the savers

  - ### getSaverForFile

    public static AbstractFileSaver getSaverForFile(String filename)
    tries to determine the saver to use for this kind of file, returns null if none can be found.
    Parameters:
      `filename` - the file to return a converter for
    Returns:
      the converter if one was found, null otherwise

  - ### getSaversForFile

    public static List<AbstractFileSaver> getSaversForFile(String filename)
    tries to determine the savers to use for this kind of file.
    Parameters:
      `filename` - the file to return converters for
    Returns:
      the converters, empty list if none found

  - ### getSaverForFile

    public static AbstractFileSaver getSaverForFile(File file)
    tries to determine the saver to use for this kind of file, returns null if none can be found.
    Parameters:
      `file` - the file to return a converter for
    Returns:
      the converter if one was found, null otherwise

  - ### getSaversForFile

    public static List<AbstractFileSaver> getSaversForFile(File file)
    tries to determine the savers to use for this kind of file.
    Parameters:
      `file` - the file to return converters for
    Returns:
      the converters, empty list if none found

  - ### getSaverForExtension

    public static AbstractFileSaver getSaverForExtension(String extension)
    tries to determine the saver to use for this kind of extension, returns null if none can be found.
    Parameters:
      `extension` - the file extension to return a converter for
    Returns:
      the converter if one was found, null otherwise

  - ### getSaversForExtension

    public static List<AbstractFileSaver> getSaversForExtension(String extension)
    tries to determine the savers to use for this kind of extension.
    Parameters:
      `extension` - the file extension to return converters for
    Returns:
      the converters, empty list if none found

  - ### getRevision

    public String getRevision()
    Returns the revision string.
    Specified by:
      `getRevision` in interface `RevisionHandler`
    Returns:
      the revision