Package adams.data.io.output
Class AbstractImageWriter<T extends AbstractImageContainer>
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.data.io.output.AbstractImageWriter<T>
-
- All Implemented Interfaces:
Destroyable,GlobalInfoSupporter,FileFormatHandler,LoggingLevelHandler,LoggingSupporter,OptionHandler,SizeOfHandler,ImageWriter<T>,Serializable
- Direct Known Subclasses:
ApacheCommonsImageWriter,BoofCVImageWriter,GrayOrIndexedImageWriter,JAIExplicitImageWriter,JAIImageWriter,OpenCVImageWriter
public abstract class AbstractImageWriter<T extends AbstractImageContainer> extends AbstractOptionHandler implements ImageWriter<T>
Ancestor for image writers.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description AbstractImageWriter()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidcheck(T cont)Performs checks.protected abstract StringdoWrite(PlaceholderFile file, T cont)Performs the actual writing of the image file.abstract ImageReadergetCorrespondingReader()Returns, if available, the corresponding reader.StringgetDefaultFormatExtension()Returns the default extension of the format.abstract StringgetFormatDescription()Returns a string describing the format (used in the file chooser).abstract String[]getFormatExtensions()Returns the extension(s) of the format.static String[]getWriters()Returns a list with classnames of writers.booleanisAvailable()Returns whether the writer is actually available.Stringwrite(PlaceholderFile file, T cont)Writes the image file.-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, defineOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, globalInfo, initialize, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.Destroyable
destroy
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
Methods inherited from interface adams.core.option.OptionHandler
cleanUpOptions, defineOptions, getOptionManager, toCommandLine
-
-
-
-
Method Detail
-
getFormatDescription
public abstract String getFormatDescription()
Returns a string describing the format (used in the file chooser).- Specified by:
getFormatDescriptionin interfaceFileFormatHandler- Returns:
- a description suitable for displaying in the file chooser
-
getFormatExtensions
public abstract String[] getFormatExtensions()
Returns the extension(s) of the format.- Specified by:
getFormatExtensionsin interfaceFileFormatHandler- Returns:
- the extension (without the dot!)
-
getDefaultFormatExtension
public String getDefaultFormatExtension()
Returns the default extension of the format.- Specified by:
getDefaultFormatExtensionin interfaceFileFormatHandler- Returns:
- the default extension (without the dot!)
-
getCorrespondingReader
public abstract ImageReader getCorrespondingReader()
Returns, if available, the corresponding reader.- Specified by:
getCorrespondingReaderin interfaceImageWriter<T extends AbstractImageContainer>- Returns:
- the reader, null if none available
-
isAvailable
public boolean isAvailable()
Returns whether the writer is actually available.- Specified by:
isAvailablein interfaceImageWriter<T extends AbstractImageContainer>- Returns:
- true if available and ready to use
-
check
protected void check(T cont)
Performs checks.- Parameters:
cont- the image container to check
-
doWrite
protected abstract String doWrite(PlaceholderFile file, T cont)
Performs the actual writing of the image file.- Parameters:
file- the file to write tocont- the image container to write- Returns:
- null if successfully written, otherwise error message
-
write
public String write(PlaceholderFile file, T cont)
Writes the image file.- Specified by:
writein interfaceImageWriter<T extends AbstractImageContainer>- Parameters:
file- the file to write tocont- the image container to write- Returns:
- null if successfully written, otherwise error message
-
getWriters
public static String[] getWriters()
Returns a list with classnames of writers.- Returns:
- the writer classnames
-
-