|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectunbbayes.io.FileExtensionIODelegator
public class FileExtensionIODelegator
This class delegates to a specified IO class by comparing the file extensions,
using BaseIO#supportsExtension(String)
.
Nested Class Summary | |
---|---|
class |
FileExtensionIODelegator.MoreThanOneCompatibleIOException
This is an exception thrown when more than one IO class can be used to delegate. |
Constructor Summary | |
---|---|
protected |
FileExtensionIODelegator()
Deprecated. |
Method Summary | |
---|---|
static BaseIO |
findIOByName(List<BaseIO> ios,
String name)
Obtains the first I/O class having its BaseIO.getName() equals
to the given parameter. |
List<BaseIO> |
getCompatibleIOs(File file,
boolean isLoadOnly)
Since this class is a delegator to another IO class, there can be more than one compatible IO for a given file. |
List<BaseIO> |
getDelegators()
|
String |
getName()
Gets the name of this I/O component. |
static String[] |
getNamesFromIOs(List<BaseIO> ios)
Obtains an array of names from a given list of I/O classes. |
String[] |
getSupportedFileExtensions(boolean isLoadOnly)
Obtains an array of file extensions supported by this network window. |
String |
getSupportedFilesDescription(boolean isLoadOnly)
Gets a description of supported file extensions, which may be shown to the user through file chooser's file filter to explain what file format are supported. |
Graph |
load(File input)
Loads a new network from the input file. |
static FileExtensionIODelegator |
newInstance()
Constructor method. |
void |
save(File output,
Graph net)
Saves a network to the output file. |
void |
setDelegators(List<BaseIO> delegators)
|
void |
setName(String name)
Sets the name of this I/O component. |
boolean |
supports(File file,
boolean isLoadOnly)
Returns true if the file is supported by this IO class. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected FileExtensionIODelegator()
newInstance()
instead.
Method Detail |
---|
public static FileExtensionIODelegator newInstance()
PluginAwareFileExtensionIODelegator
.public List<BaseIO> getCompatibleIOs(File file, boolean isLoadOnly)
file
- use
- true if it must return the IO classes for loading a file. Use "false" if it
is for saving a file.
public Graph load(File input) throws LoadException, IOException
BaseIO
load
in interface BaseIO
input
- the input file for the network
LoadException
- If the file doesn't describe a network.
IOException
- If an IO error occurspublic void save(File output, Graph net) throws IOException
BaseIO
save
in interface BaseIO
output
- The output file to savenet
- The network to save.
IOException
public boolean supports(File file, boolean isLoadOnly)
BaseIO
supports
in interface BaseIO
file
- : the file to analyze extension.isLoadOnly
- : if set to true, it should consider file extensions for file loading (input).
If set to false, it should consider both saving and loading. Note
that not every I/O class can implement both loading and saving, and this parameter may separate such
special behaviors.
public List<BaseIO> getDelegators()
public void setDelegators(List<BaseIO> delegators)
delegators
- the delegators to setpublic String[] getSupportedFileExtensions(boolean isLoadOnly)
BaseIO
getSupportedFileExtensions
in interface BaseIO
isLoadOnly
- : if set to true, it should consider file extensions for file loading (input).
If set to false, it should consider both saving and loading. Note
that not every module/plugin can implement both loading and saving, and this parameter may separate such
special behaviors.
public String getSupportedFilesDescription(boolean isLoadOnly)
BaseIO
getSupportedFilesDescription
in interface BaseIO
isLoadOnly
- : if set to true, it should consider file extensions for file loading (input).
If set to false, it should consider both saving and loading. Note
that not every module/plugin can implement both loading and saving, and this parameter may separate such
special behaviors.public static String[] getNamesFromIOs(List<BaseIO> ios)
#openFile(File)
in order to fill a list
of I/O component's names, in order to ask users what I/O they prefer to use,
when multiple options are available.
ios
-
BaseIO.getName()
,
#findIOByName(List)
public static BaseIO findIOByName(List<BaseIO> ios, String name)
BaseIO.getName()
equals
to the given parameter.
ios
- name
-
BaseIO.getName()
,
getNamesFromIOs(List)
public String getName()
BaseIO
getName
in interface BaseIO
public void setName(String name)
BaseIO
setName
in interface BaseIO
name
- the name to set
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |