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.FiledataFileprotected java.net.URLdataURLprotected InterfaceIOOptionsoptions -
Constructor Summary
Constructors Constructor Description FileLoader() -
Method Summary
Modifier and Type Method Description InterfaceIOTypegetComplementIOType()Returns anInterfaceIOTypespecifying theInterfaceIOwhich performs the complementary operation to this one.java.lang.StringgetFailureMessage()Returns a message to indicate that loading failed.java.io.FilegetFile()Returns the current data file for this loader.InterfaceIOTypegetIOType()Returns the registered IO type for this object, if one existsjavax.swing.IcongetObjectIcon()Returns theIconassociated with this object.InterfaceIOOptionsgetOptions()Gets theInterfaceIOOptionsspecifying this I/O operation, if options have been set; otherwise returnsnull.java.lang.StringgetProgressMessage()Returns a message for the progress updater, while loading is in progress.java.lang.StringgetSuccessMessage()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.StringgetTitle()InterfaceIOTypegetWriterComplement()Returns theInterfaceIOTypeof aFileWriterwhich is the complement of this loader; i.e., writes what this loader reads with identical encoding.booleanload()Loads data from the set of files or URLs specified byoptions.booleanload(ProgressUpdater progress_bar)Loads data from the set of files or URLs specified byoptions.abstract booleanload(InterfaceIOOptions options, ProgressUpdater progress_bar)Loads data from the set of files or URLs specified byoptions.java.lang.ObjectloadObject()Loads data into an instance of the object corresponding to this loader.java.lang.ObjectloadObject(ProgressUpdater progress_bar)Loads data into an instance of the object corresponding to this loader.java.lang.ObjectloadObject(ProgressUpdater progress_bar, InterfaceIOOptions options)Loads data into an instance of the object corresponding to this loader.java.lang.ObjectloadObject(InterfaceIOOptions options)Loads data into an instance of the object corresponding to this loader.voidsetFile(java.io.File file)Sets the current File for this loader.voidsetOptions(InterfaceIOOptions options)Sets theInterfaceIOOptionsspecifying this I/O operationvoidsetURL(java.net.URL url)Sets the current URL for this loader.java.lang.StringtoString()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:
setFilein interfaceInterfaceIO
-
setURL
public void setURL(java.net.URL url)Sets the current URL for this loader. Sets the File tonull.- Specified by:
setURLin interfaceInterfaceIO
-
getFile
public java.io.File getFile()Returns the current data file for this loader.- Returns:
-
setOptions
Description copied from interface:InterfaceIOSets theInterfaceIOOptionsspecifying this I/O operation- Specified by:
setOptionsin interfaceInterfaceIO
-
getOptions
Description copied from interface:InterfaceIOGets theInterfaceIOOptionsspecifying this I/O operation, if options have been set; otherwise returnsnull.- Specified by:
getOptionsin 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:InterfaceIOReturns the registered IO type for this object, if one exists- Specified by:
getIOTypein interfaceInterfaceIO- Returns:
- the registered IO type, or
nullif 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:
getProgressMessagein interfaceInterfaceIO- Returns:
- Progress message
-
getSuccessMessage
public java.lang.String getSuccessMessage()Returns a message to indicate that loading was successful.- Specified by:
getSuccessMessagein 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:
getTitlein interfaceInterfaceIO
-
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-
getWriterComplement
Returns theInterfaceIOTypeof aFileWriterwhich 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
nullif no complement is defined.- Returns:
-
getObjectIcon
public javax.swing.Icon getObjectIcon()Description copied from interface:IconObjectReturns theIconassociated with this object.- Specified by:
getObjectIconin interfaceIconObject- Returns:
-
getSupportedObjects
public java.util.ArrayList<java.lang.Class<?>> getSupportedObjects()Description copied from interface:InterfaceIOReturns a list of classes for objects which are supported by this I/O interface- Specified by:
getSupportedObjectsin interfaceInterfaceIO- Returns:
-
getComplementIOType
Description copied from interface:InterfaceIOReturns anInterfaceIOTypespecifying theInterfaceIOwhich performs the complementary operation to this one. I.e., loaders should specify their complementary writers.- Specified by:
getComplementIOTypein interfaceInterfaceIO- Returns:
- The complementary class, or
nullif none is defined
-