Package mgui.io
Class FileWriter
java.lang.Object
mgui.io.FileWriter
- All Implemented Interfaces:
InterfaceIO
,IconObject
- Direct Known Subclasses:
CaminoPipelineWriter
,CaminoProjectWriter
,CaretAreaColourWriter
,ContinuousColourMapWriter
,DataSourceDriverWriter
,DataSourceWriter
,DiscreteColourMapWriter
,ExportDataTableWriter
,Graph3DWriter
,GraphFileWriter
,InterfaceShapeWriter
,JsonFileWriter
,MatrixFileWriter
,NameMapWriter
,PipelineProcessLibraryWriter
,PipelineWriter
,SurfaceDataFileWriter
,SurfaceFileWriter
,VideoWriter
,View3DWriter
,VolumeFileWriter
,XMLWriter
public abstract class FileWriter extends java.lang.Object implements InterfaceIO
Base class for all file writer 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 java.lang.String
failure_message
protected InterfaceIOOptions
options
protected java.lang.String
success_message
-
Constructor Summary
Constructors Constructor Description FileWriter()
-
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()
java.io.File
getFile()
InterfaceIOType
getIOType()
Returns the registered IO type for this object, if one existsInterfaceIOType
getLoaderComplement()
Returns theInterfaceIOType
of aFileLoader
which is the complement of this writer; i.e., reads what this writer writes with identical encoding.javax.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()
java.lang.String
getSuccessMessage()
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()
java.net.URL
getURL()
void
setFile(java.io.File file)
void
setOptions(InterfaceIOOptions options)
Sets theInterfaceIOOptions
specifying this I/O operationvoid
setURL(java.net.URL url)
java.lang.String
toString()
boolean
write()
Write the object to file subject to the given set of options.boolean
write(ProgressUpdater progress_bar)
abstract boolean
write(InterfaceIOOptions options, ProgressUpdater progress_bar)
Writes this object according to the givenoptions
.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
-
failure_message
protected java.lang.String failure_message -
success_message
protected java.lang.String success_message
-
-
Constructor Details
-
FileWriter
public FileWriter()
-
-
Method Details
-
setFile
public void setFile(java.io.File file)- Specified by:
setFile
in interfaceInterfaceIO
-
setURL
public void setURL(java.net.URL url)- Specified by:
setURL
in interfaceInterfaceIO
-
getFile
public java.io.File getFile() -
getURL
public java.net.URL getURL() -
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
-
write
public boolean write()Write the object to file subject to the given set of options.- Returns:
-
write
-
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
-
write
Writes this object according to the givenoptions
. If loaded object is of typePersistentObject
, this method should also set the file writer and reference URL for the object.- Parameters:
options
-progress_bar
-- Returns:
-
getProgressMessage
public java.lang.String getProgressMessage()- Specified by:
getProgressMessage
in interfaceInterfaceIO
-
getSuccessMessage
public java.lang.String getSuccessMessage()- Specified by:
getSuccessMessage
in interfaceInterfaceIO
-
getFailureMessage
public java.lang.String getFailureMessage() -
getTitle
public java.lang.String getTitle()- Specified by:
getTitle
in interfaceInterfaceIO
-
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-
getLoaderComplement
Returns theInterfaceIOType
of aFileLoader
which is the complement of this writer; i.e., reads what this writer writes 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
-