Package adams.data.io.output
Class JAIImageWriter
-
- All Implemented Interfaces:
Destroyable,GlobalInfoSupporter,FileFormatHandler,LoggingLevelHandler,LoggingSupporter,OptionHandler,SizeOfHandler,ImageWriter<BufferedImageContainer>,OutputStreamImageWriter<BufferedImageContainer>,Serializable
public class JAIImageWriter extends AbstractImageWriter<BufferedImageContainer> implements OutputStreamImageWriter<BufferedImageContainer>
Java Advanced Imaging (JAI) image writer for: bmp, jpg, jpeg, wbmp, png, gif
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected String[]m_FormatExtensionsthe format extensions.protected Stringm_ImageFormatthe image format to use (uses file extension to determine it if empty).-
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 JAIImageWriter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddefineOptions()Adds options to the internal list of options.protected StringdoWrite(PlaceholderFile file, BufferedImageContainer cont)Performs the actual writing of the image file.ImageReadergetCorrespondingReader()Returns, if available, the corresponding reader.StringgetFormatDescription()Returns a string describing the format (used in the file chooser).String[]getFormatExtensions()Returns the extension(s) of the format.StringgetImageFormat()Returns the image format to use.ImageWritergetWriter()Returns the reader for the default extension.StringglobalInfo()Returns a string describing the object.StringimageFormatTipText()Returns the tip text for this property.protected voidinitialize()Initializes the members.voidsetImageFormat(String value)Sets the image format to use.Stringwrite(OutputStream stream, BufferedImageContainer cont)Writes the image to the stream.-
Methods inherited from class adams.data.io.output.AbstractImageWriter
check, getDefaultFormatExtension, getWriters, isAvailable, write
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, 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.io.FileFormatHandler
getDefaultFormatExtension
-
Methods inherited from interface adams.data.io.output.ImageWriter
isAvailable, write
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
Methods inherited from interface adams.core.option.OptionHandler
cleanUpOptions, getOptionManager, toCommandLine
-
-
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfoin interfaceGlobalInfoSupporter- Specified by:
globalInfoin classAbstractOptionHandler- Returns:
- a description suitable for displaying in the gui
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initializein classAbstractOptionHandler
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceOptionHandler- Overrides:
defineOptionsin classAbstractOptionHandler
-
setImageFormat
public void setImageFormat(String value)
Sets the image format to use. Requires an explicit format (other than empty string) when writing to a stream.- Parameters:
value- the format
-
getImageFormat
public String getImageFormat()
Returns the image format to use. Requires an explicit format (other than empty string) when writing to a stream.- Returns:
- the format
-
imageFormatTipText
public String imageFormatTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getFormatDescription
public String getFormatDescription()
Returns a string describing the format (used in the file chooser).- Specified by:
getFormatDescriptionin interfaceFileFormatHandler- Specified by:
getFormatDescriptionin classAbstractImageWriter<BufferedImageContainer>- Returns:
- a description suitable for displaying in the file chooser
-
getFormatExtensions
public String[] getFormatExtensions()
Returns the extension(s) of the format.- Specified by:
getFormatExtensionsin interfaceFileFormatHandler- Specified by:
getFormatExtensionsin classAbstractImageWriter<BufferedImageContainer>- Returns:
- the extension(s) (without the dot!)
-
getCorrespondingReader
public ImageReader getCorrespondingReader()
Returns, if available, the corresponding reader.- Specified by:
getCorrespondingReaderin interfaceImageWriter<BufferedImageContainer>- Specified by:
getCorrespondingReaderin classAbstractImageWriter<BufferedImageContainer>- Returns:
- the reader, null if none available
-
getWriter
public ImageWriter getWriter()
Returns the reader for the default extension.- Returns:
- the JAI reader
- See Also:
AbstractImageWriter.getDefaultFormatExtension()
-
doWrite
protected String doWrite(PlaceholderFile file, BufferedImageContainer cont)
Performs the actual writing of the image file.- Specified by:
doWritein classAbstractImageWriter<BufferedImageContainer>- Parameters:
file- the file to write tocont- the image container to write- Returns:
- null if successfully written, otherwise error message
-
write
public String write(OutputStream stream, BufferedImageContainer cont)
Writes the image to the stream. Callers must close the stream.- Specified by:
writein interfaceOutputStreamImageWriter<BufferedImageContainer>- Parameters:
stream- the stream to write tocont- the image container to write- Returns:
- null if successfully written, otherwise error message
-
-