javax.media.jai.operator
Class EncodeDescriptor

java.lang.Object
  extended byjavax.media.jai.OperationDescriptorImpl
      extended byjavax.media.jai.operator.EncodeDescriptor
All Implemented Interfaces:
OperationDescriptor, RegistryElementDescriptor, Serializable

public class EncodeDescriptor
extends OperationDescriptorImpl

An OperationDescriptor describing the "Encode" operation. The "Encode" operation writes an image to a given OutputStream in a specified format using the supplied encoding parameters.

The third parameter contains an instance of ImageEncodeParam to be used during the decoding. It may be set to null in order to perform default encoding, or equivalently may be omitted. If non-null, it must be of the correct class type for the selected format.

The classes in the com.sun.media.jai.codec package are not a committed part of the JAI API. Future releases of JAI will make use of new classes in their place. This class will change accordingly.

Resource List
Name Value
GlobalName encode
LocalName encode
Vendor com.sun.media.jai
Description Stores an image to an OutputStream.
DocURL http://java.sun.com/products/java-media/jai/forDevelopers/jai-apidocs/javax/media/jai/operator/EncodeDescriptor.html
Version 1.0
arg0Desc The OutputStream to write to.
arg1Desc The format of the created file.
arg2Desc The encoding parameters.

Parameter List
Name Class Type Default Value
stream java.io.OutputStream NO_PARAMETER_DEFAULT
format java.lang.String "tiff"
param com.sun.media.jai.codec.ImageEncodeParam null

See Also:
OperationDescriptor, Serialized Form

Field Summary
 
Fields inherited from class javax.media.jai.OperationDescriptorImpl
sourceNames
 
Fields inherited from interface javax.media.jai.OperationDescriptor
NO_PARAMETER_DEFAULT
 
Constructor Summary
EncodeDescriptor()
          Constructor.
 
Method Summary
static RenderedOp create(RenderedImage source0, OutputStream stream, String format, ImageEncodeParam param, RenderingHints hints)
          Stores an image to an OutputStream.
 boolean isImmediate()
          Returns true indicating that the operation should be rendered immediately during a call to JAI.create().
 boolean validateArguments(String modeName, ParameterBlock args, StringBuffer msg)
          Validates the input source and parameters.
 
Methods inherited from class javax.media.jai.OperationDescriptorImpl
arePropertiesSupported, getDefaultSourceClass, getDestClass, getDestClass, getInvalidRegion, getName, getNumParameters, getNumSources, getParamClasses, getParamDefaults, getParamDefaultValue, getParameterListDescriptor, getParamMaxValue, getParamMinValue, getParamNames, getPropertyGenerators, getPropertyGenerators, getRenderableDestClass, getRenderableSourceClasses, getResourceBundle, getResources, getSourceClasses, getSourceClasses, getSourceNames, getSupportedModes, isModeSupported, isRenderableSupported, isRenderedSupported, makeDefaultSourceClassList, validateArguments, validateParameters, validateParameters, validateRenderableArguments, validateRenderableSources, validateSources, validateSources
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EncodeDescriptor

public EncodeDescriptor()
Constructor.

Method Detail

validateArguments

public boolean validateArguments(String modeName,
                                 ParameterBlock args,
                                 StringBuffer msg)
Validates the input source and parameters.

In addition to the standard checks performed by the superclass method, this method checks that the format name is recognized and is capable of encoding the source image using the encoding parameter "param", if non-null.

Specified by:
validateArguments in interface OperationDescriptor
Overrides:
validateArguments in class OperationDescriptorImpl
Parameters:
modeName - the operation mode name
args - Input arguments, including source(s) and/or parameter(s).
msg - A string that may contain error messages.
See Also:
OperationDescriptorImpl.validateSources(java.lang.String, java.awt.image.renderable.ParameterBlock, java.lang.StringBuffer), OperationDescriptorImpl.validateParameters(java.lang.String, java.awt.image.renderable.ParameterBlock, java.lang.StringBuffer)

isImmediate

public boolean isImmediate()
Returns true indicating that the operation should be rendered immediately during a call to JAI.create().

Specified by:
isImmediate in interface OperationDescriptor
Overrides:
isImmediate in class OperationDescriptorImpl
See Also:
OperationDescriptor

create

public static RenderedOp create(RenderedImage source0,
                                OutputStream stream,
                                String format,
                                ImageEncodeParam param,
                                RenderingHints hints)
Stores an image to an OutputStream.

Creates a ParameterBlockJAI from all supplied arguments except hints and invokes JAI.create(String,ParameterBlock,RenderingHints).

Parameters:
source0 - RenderedImage source 0.
stream - The OutputStream to write to.
format - The format of the created file. May be null.
param - The encoding parameters. May be null.
hints - The RenderingHints to use. May be null.
Returns:
The RenderedOp destination.
Throws:
IllegalArgumentException - if source0 is null.
IllegalArgumentException - if stream is null.
See Also:
JAI, ParameterBlockJAI, RenderedOp