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_FormatExtensions
the format extensions.protected String
m_ImageFormat
the 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 void
defineOptions()
Adds options to the internal list of options.protected String
doWrite(PlaceholderFile file, BufferedImageContainer cont)
Performs the actual writing of the image file.ImageReader
getCorrespondingReader()
Returns, if available, the corresponding reader.String
getFormatDescription()
Returns a string describing the format (used in the file chooser).String[]
getFormatExtensions()
Returns the extension(s) of the format.String
getImageFormat()
Returns the image format to use.ImageWriter
getWriter()
Returns the reader for the default extension.String
globalInfo()
Returns a string describing the object.String
imageFormatTipText()
Returns the tip text for this property.protected void
initialize()
Initializes the members.void
setImageFormat(String value)
Sets the image format to use.String
write(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:
globalInfo
in interfaceGlobalInfoSupporter
- Specified by:
globalInfo
in classAbstractOptionHandler
- Returns:
- a description suitable for displaying in the gui
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initialize
in classAbstractOptionHandler
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in 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:
getFormatDescription
in interfaceFileFormatHandler
- Specified by:
getFormatDescription
in 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:
getFormatExtensions
in interfaceFileFormatHandler
- Specified by:
getFormatExtensions
in classAbstractImageWriter<BufferedImageContainer>
- Returns:
- the extension(s) (without the dot!)
-
getCorrespondingReader
public ImageReader getCorrespondingReader()
Returns, if available, the corresponding reader.- Specified by:
getCorrespondingReader
in interfaceImageWriter<BufferedImageContainer>
- Specified by:
getCorrespondingReader
in 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:
doWrite
in 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:
write
in interfaceOutputStreamImageWriter<BufferedImageContainer>
- Parameters:
stream
- the stream to write tocont
- the image container to write- Returns:
- null if successfully written, otherwise error message
-
-