weka.core.converters

## Class ConverterUtils

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

- All Implemented Interfaces:
    java.io.Serializable, RevisionHandler

      public class ConverterUtils
      extends java.lang.Object
      implements java.io.Serializable, RevisionHandler

  Utility routines for the converter package.
  Version:
    $Revision: 14285 $
  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 and 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 and Description
    `ConverterUtils()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `errms(java.io.StreamTokenizer tokenizer, java.lang.String theMsg)` Throws error message with line number and last token read.
    `static java.util.Vector<java.lang.String>` | `getFileLoaders()` returns a vector with the classnames of all the file loaders.
    `static java.util.Vector<java.lang.String>` | `getFileSavers()` returns a vector with the classnames of all the file savers.
    `static void` | `getFirstToken(java.io.StreamTokenizer tokenizer)` Gets token, skipping empty lines.
    `static AbstractFileLoader` | `getLoaderForExtension(java.lang.String extension)` tries to determine the loader to use for this kind of extension, returns null if none can be found.
    `static AbstractFileLoader` | `getLoaderForFile(java.io.File file)` tries to determine the loader to use for this kind of file, returns null if none can be found.
    `static AbstractFileLoader` | `getLoaderForFile(java.lang.String filename)` tries to determine the loader to use for this kind of file, returns null if none can be found.
    `java.lang.String` | `getRevision()` Returns the revision string.
    `static AbstractFileSaver` | `getSaverForExtension(java.lang.String extension)` tries to determine the saver to use for this kind of extension, returns null if none can be found.
    `static AbstractFileSaver` | `getSaverForFile(java.io.File file)` tries to determine the saver to use for this kind of file, returns null if none can be found.
    `static AbstractFileSaver` | `getSaverForFile(java.lang.String filename)` tries to determine the saver to use for this kind of file, returns null if none can be found.
    `static void` | `getToken(java.io.StreamTokenizer tokenizer)` Gets token.
    `static java.util.Vector<java.lang.String>` | `getURLFileLoaders()` returns a vector with the classnames of all the URL file loaders.
    `static AbstractFileLoader` | `getURLLoaderForExtension(java.lang.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(java.io.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(java.lang.String filename)` tries to determine the URL loader to use for this kind of file, returns null if none can be found.
    `static void` | `initialize()`

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

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

- - ### Constructor Detail

    - #### ConverterUtils

          public ConverterUtils()

  - ### Method Detail

    - #### initialize

          public static void initialize()

    - #### getFirstToken

          public static void getFirstToken(java.io.StreamTokenizer tokenizer)
                                    throws java.io.IOException

      Gets token, skipping empty lines.
      Parameters:
        `tokenizer` - the stream tokenizer
      Throws:
        `java.io.IOException` - if reading the next token fails

    - #### getToken

          public static void getToken(java.io.StreamTokenizer tokenizer)
                               throws java.io.IOException

      Gets token.
      Parameters:
        `tokenizer` - the stream tokenizer
      Throws:
        `java.io.IOException` - if reading the next token fails

    - #### errms

          public static void errms(java.io.StreamTokenizer tokenizer,
                                   java.lang.String theMsg)
                            throws java.io.IOException

      Throws error message with line number and last token read.
      Parameters:
        `theMsg` - the error message to be thrown
        `tokenizer` - the stream tokenizer
      Throws:
        `java.io.IOException` - containing the error message

    - #### getFileLoaders

          public static java.util.Vector<java.lang.String> getFileLoaders()

      returns a vector with the classnames of all the file loaders.
      Returns:
        the classnames of the loaders

    - #### getLoaderForFile

          public static AbstractFileLoader getLoaderForFile(java.lang.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

    - #### getLoaderForFile

          public static AbstractFileLoader getLoaderForFile(java.io.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

    - #### getLoaderForExtension

          public static AbstractFileLoader getLoaderForExtension(java.lang.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 java.util.Vector<java.lang.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(java.lang.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

    - #### getURLLoaderForFile

          public static AbstractFileLoader getURLLoaderForFile(java.io.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

    - #### getURLLoaderForExtension

          public static AbstractFileLoader getURLLoaderForExtension(java.lang.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

    - #### getFileSavers

          public static java.util.Vector<java.lang.String> getFileSavers()

      returns a vector with the classnames of all the file savers.
      Returns:
        the classnames of the savers

    - #### getSaverForFile

          public static AbstractFileSaver getSaverForFile(java.lang.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

    - #### getSaverForFile

          public static AbstractFileSaver getSaverForFile(java.io.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

    - #### getSaverForExtension

          public static AbstractFileSaver getSaverForExtension(java.lang.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

    - #### getRevision

          public java.lang.String getRevision()

      Returns the revision string.
      Specified by:
        `getRevision` in interface `RevisionHandler`
      Returns:
        the revision