Package mgui.io
Class FileLoader
java.lang.Object
mgui.io.FileLoader
- All Implemented Interfaces:
InterfaceIO
,IconObject
- Direct Known Subclasses:
CaminoPipelineLoader
,CaminoProjectLoader
,ColourMapLoader
,CorticalNetworkMatrixLoader
,DataSourceDriverLoader
,DataSourceLoader
,GraphFileLoader
,ImageFileLoader
,ImportDataTableLoader
,InterfaceShapeLoader
,JsonFileLoader
,MatrixFileLoader
,MatrixTransformLoader
,MincTransformLoader
,NameMapLoader
,PipelineLoader
,PipelineProcessLibraryLoader
,Point2DShapeLoader
,PointSet3DDataLoader
,PointSet3DLoader
,PolygonSet3DLoader
,ShapeDataLoader
,ShapeModel3DLoader
,StringVectorLoader
,SurfaceDataFileLoader
,Vector3DFileLoader
,VectorSet3DLoader
,VideoLoader
,View3DLoader
public abstract class FileLoader extends java.lang.Object implements InterfaceIO
Base class for all file loader classes.
- Since:
- 1.0
- Version:
- 1.0
- Author:
- Andrew Reid
-
Field Summary
Fields Modifier and Type Field Description protected java.io.File
dataFile
protected java.net.URL
dataURL
protected InterfaceIOOptions
options
-
Constructor Summary
Constructors Constructor Description FileLoader()
-
Method Summary
Modifier and Type Method Description InterfaceIOType
getComplementIOType()
Returns anInterfaceIOType
specifying theInterfaceIO
which performs the complementary operation to this one.java.lang.String
getFailureMessage()
Returns a message to indicate that loading failed.java.io.File
getFile()
Returns the current data file for this loader.InterfaceIOType
getIOType()
Returns the registered IO type for this object, if one existsjavax.swing.Icon
getObjectIcon()
Returns theIcon
associated with this object.InterfaceIOOptions
getOptions()
Gets theInterfaceIOOptions
specifying this I/O operation, if options have been set; otherwise returnsnull
.java.lang.String
getProgressMessage()
Returns a message for the progress updater, while loading is in progress.java.lang.String
getSuccessMessage()
Returns a message to indicate that loading was successful.java.util.ArrayList<java.lang.Class<?>>
getSupportedObjects()
Returns a list of classes for objects which are supported by this I/O interfacejava.lang.String
getTitle()
InterfaceIOType
getWriterComplement()
Returns theInterfaceIOType
of aFileWriter
which is the complement of this loader; i.e., writes what this loader reads with identical encoding.boolean
load()
Loads data from the set of files or URLs specified byoptions
.boolean
load(ProgressUpdater progress_bar)
Loads data from the set of files or URLs specified byoptions
.abstract boolean
load(InterfaceIOOptions options, ProgressUpdater progress_bar)
Loads data from the set of files or URLs specified byoptions
.java.lang.Object
loadObject()
Loads data into an instance of the object corresponding to this loader.java.lang.Object
loadObject(ProgressUpdater progress_bar)
Loads data into an instance of the object corresponding to this loader.java.lang.Object
loadObject(ProgressUpdater progress_bar, InterfaceIOOptions options)
Loads data into an instance of the object corresponding to this loader.java.lang.Object
loadObject(InterfaceIOOptions options)
Loads data into an instance of the object corresponding to this loader.void
setFile(java.io.File file)
Sets the current File for this loader.void
setOptions(InterfaceIOOptions options)
Sets theInterfaceIOOptions
specifying this I/O operationvoid
setURL(java.net.URL url)
Sets the current URL for this loader.java.lang.String
toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Field Details
-
dataFile
protected java.io.File dataFile -
dataURL
protected java.net.URL dataURL -
options
-
-
Constructor Details
-
FileLoader
public FileLoader()
-
-
Method Details
-
setFile
public void setFile(java.io.File file)Sets the current File for this loader. Sets the URL tonull
.- Specified by:
setFile
in interfaceInterfaceIO
-
setURL
public void setURL(java.net.URL url)Sets the current URL for this loader. Sets the File tonull
.- Specified by:
setURL
in interfaceInterfaceIO
-
getFile
public java.io.File getFile()Returns the current data file for this loader.- Returns:
-
setOptions
Description copied from interface:InterfaceIO
Sets theInterfaceIOOptions
specifying this I/O operation- Specified by:
setOptions
in interfaceInterfaceIO
-
getOptions
Description copied from interface:InterfaceIO
Gets theInterfaceIOOptions
specifying this I/O operation, if options have been set; otherwise returnsnull
.- Specified by:
getOptions
in interfaceInterfaceIO
-
load
public boolean load()Loads data from the set of files or URLs specified byoptions
. Loading is controlled by the specifications ofoptions
.This method should also set the URL reference and writer and loader attributes to match this one and its complement.
- Returns:
-
load
Loads data from the set of files or URLs specified byoptions
. Loading is controlled by the specifications ofoptions
.This method should also set the URL reference and writer and loader attributes to match this one and its complement.
- Parameters:
progress_bar
-- Returns:
-
load
Loads data from the set of files or URLs specified byoptions
. Loading is controlled by the specifications ofoptions
. If loaded object is of typePersistentObject
, this method should also set the file loader and reference URL for the object.This method should also set the URL reference and writer and loader attributes to match this one and its complement.
- Parameters:
options
-progress_bar
- An optional progress updater. Can benull
.- Returns:
-
loadObject
public java.lang.Object loadObject() throws java.io.IOExceptionLoads data into an instance of the object corresponding to this loader. If loaded object is of typePersistentObject
, this method should also set the file loader and reference URL for the object. TODO: make generic?- Returns:
- Throws:
java.io.IOException
-
loadObject
Loads data into an instance of the object corresponding to this loader. If loaded object is of typePersistentObject
, this method should also set the file loader and reference URL for the object. TODO: make generic?- Parameters:
options
-- Returns:
- Throws:
java.io.IOException
-
getIOType
Description copied from interface:InterfaceIO
Returns the registered IO type for this object, if one exists- Specified by:
getIOType
in interfaceInterfaceIO
- Returns:
- the registered IO type, or
null
if none exists
-
loadObject
public java.lang.Object loadObject(ProgressUpdater progress_bar, InterfaceIOOptions options) throws java.io.IOExceptionLoads data into an instance of the object corresponding to this loader. If loaded object is of typePersistentObject
, this method should also set the file loader and reference URL for the object. TODO: make generic?- Parameters:
progress_bar
- An optional progress updater. Can benull
.options
- Options defining the loading process- Returns:
- Throws:
java.io.IOException
-
loadObject
Loads data into an instance of the object corresponding to this loader. If loaded object is of typePersistentObject
, this method should also set the file loader and reference URL for the object. TODO: make generic?- Parameters:
progress_bar
- An optional progress updater. Can benull
.- Returns:
- Throws:
java.io.IOException
-
getProgressMessage
public java.lang.String getProgressMessage()Returns a message for the progress updater, while loading is in progress.- Specified by:
getProgressMessage
in interfaceInterfaceIO
- Returns:
- Progress message
-
getSuccessMessage
public java.lang.String getSuccessMessage()Returns a message to indicate that loading was successful.- Specified by:
getSuccessMessage
in interfaceInterfaceIO
- Returns:
- Progress message
-
getFailureMessage
public java.lang.String getFailureMessage()Returns a message to indicate that loading failed.- Returns:
- Progress message
-
getTitle
public java.lang.String getTitle()- Specified by:
getTitle
in interfaceInterfaceIO
-
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-
getWriterComplement
Returns theInterfaceIOType
of aFileWriter
which is the complement of this loader; i.e., writes what this loader reads with identical encoding. Transfer between loader and writer should be lossless.Returns
null
if no complement is defined.- Returns:
-
getObjectIcon
public javax.swing.Icon getObjectIcon()Description copied from interface:IconObject
Returns theIcon
associated with this object.- Specified by:
getObjectIcon
in interfaceIconObject
- Returns:
-
getSupportedObjects
public java.util.ArrayList<java.lang.Class<?>> getSupportedObjects()Description copied from interface:InterfaceIO
Returns a list of classes for objects which are supported by this I/O interface- Specified by:
getSupportedObjects
in interfaceInterfaceIO
- Returns:
-
getComplementIOType
Description copied from interface:InterfaceIO
Returns anInterfaceIOType
specifying theInterfaceIO
which performs the complementary operation to this one. I.e., loaders should specify their complementary writers.- Specified by:
getComplementIOType
in interfaceInterfaceIO
- Returns:
- The complementary class, or
null
if none is defined
-