public class ConverterUtils extends Object implements Serializable, RevisionHandler
Serializable
,
Serialized FormModifier 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.
|
Modifier and Type | Field and Description |
---|---|
static String |
CORE_FILE_LOADERS
the core loaders - hardcoded list necessary for RMI/Remote Experiments
(comma-separated list).
|
static String |
CORE_FILE_SAVERS
the core savers - hardcoded list necessary for RMI/Remote Experiments
(comma-separated list).
|
protected static Hashtable<String,String> |
m_FileLoaders
all available loaders (extension <-> classname).
|
protected static Hashtable<String,String> |
m_FileSavers
all available savers (extension <-> classname).
|
protected static Hashtable<String,String> |
m_URLFileLoaders
all available URL loaders (extension <-> classname).
|
Constructor and Description |
---|
ConverterUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
errms(StreamTokenizer tokenizer,
String theMsg)
Throws error message with line number and last token read.
|
protected static Object |
getConverterForExtension(String extension,
Hashtable<String,String> ht)
tries to determine the loader to use for this kind of extension, returns
null if none can be found.
|
protected static Object |
getConverterForFile(String filename,
Hashtable<String,String> ht)
tries to determine the converter to use for this kind of file, returns
null if none can be found in the given hashtable.
|
protected static Vector<String> |
getConverters(Hashtable<String,String> ht)
returns a vector with the classnames of all the loaders from the
given hashtable.
|
protected static Hashtable<String,String> |
getFileConverters(String classnames,
String[] intf)
returns a hashtable with the association
"file extension <-> converter classname" for the comma-separated list
of converter classnames.
|
protected static Hashtable<String,String> |
getFileConverters(Vector classnames,
String[] intf)
returns a hashtable with the association
"file extension <-> converter classname" for the list of converter
classnames.
|
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.
|
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 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 boolean |
isCoreFileLoader(String classname)
checks whether the given class is one of the hardcoded core file loaders.
|
static boolean |
isCoreFileSaver(String classname)
checks whether the given class is one of the hardcoded core file savers.
|
public static final String CORE_FILE_LOADERS
public static final String CORE_FILE_SAVERS
protected static Hashtable<String,String> m_FileLoaders
protected static Hashtable<String,String> m_URLFileLoaders
protected static Hashtable<String,String> getFileConverters(String classnames, String[] intf)
classnames
- comma-separated list of converter classnamesintf
- interfaces the converters have to implementprotected static Hashtable<String,String> getFileConverters(Vector classnames, String[] intf)
classnames
- list of converter classnamesintf
- interfaces the converters have to implementpublic static void getFirstToken(StreamTokenizer tokenizer) throws IOException
tokenizer
- the stream tokenizerIOException
- if reading the next token failspublic static void getToken(StreamTokenizer tokenizer) throws IOException
tokenizer
- the stream tokenizerIOException
- if reading the next token failspublic static void errms(StreamTokenizer tokenizer, String theMsg) throws IOException
theMsg
- the error message to be throwntokenizer
- the stream tokenizerIOException
- containing the error messageprotected static Vector<String> getConverters(Hashtable<String,String> ht)
ht
- the hashtable with the extension/converter relationprotected static Object getConverterForFile(String filename, Hashtable<String,String> ht)
filename
- the file to return a converter forht
- the hashtable with the relation extension/converterprotected static Object getConverterForExtension(String extension, Hashtable<String,String> ht)
extension
- the file extension to return a converter forht
- the hashtable with the relation extension/converterpublic static boolean isCoreFileLoader(String classname)
classname
- the class to checkCORE_FILE_LOADERS
public static Vector<String> getFileLoaders()
public static AbstractFileLoader getLoaderForFile(String filename)
filename
- the file to return a converter forpublic static AbstractFileLoader getLoaderForFile(File file)
file
- the file to return a converter forpublic static AbstractFileLoader getLoaderForExtension(String extension)
extension
- the file extension to return a converter forpublic static Vector<String> getURLFileLoaders()
public static AbstractFileLoader getURLLoaderForFile(String filename)
filename
- the file to return a URL converter forpublic static AbstractFileLoader getURLLoaderForFile(File file)
file
- the file to return a URL converter forpublic static AbstractFileLoader getURLLoaderForExtension(String extension)
extension
- the file extension to return a URL converter forpublic static boolean isCoreFileSaver(String classname)
classname
- the class to checkCORE_FILE_SAVERS
public static Vector<String> getFileSavers()
public static AbstractFileSaver getSaverForFile(String filename)
filename
- the file to return a converter forpublic static AbstractFileSaver getSaverForFile(File file)
file
- the file to return a converter forpublic static AbstractFileSaver getSaverForExtension(String extension)
extension
- the file extension to return a converter forpublic String getRevision()
getRevision
in interface RevisionHandler
Copyright © 2015 University of Waikato, Hamilton, NZ. All rights reserved.