## javax.media.jai.registry
Class TileEncoderRegistry

    java.lang.Object
      |
      +--javax.media.jai.registry.TileEncoderRegistry

public final class TileEncoderRegistry
extends java.lang.Object

Utility class to provide type-safe interaction with the `OperationRegistry` for `TileEncoderFactory` objects. If the `OperationRegistry` specified as an argument to the methods in this class is null, then `JAI.getOperationRegistry()` will be used.

Since:
  1.1

Constructor Summary
`TileEncoderRegistry()`

Method Summary
`static void` `clearPreferences(OperationRegistry registry, java.lang.String formatName, java.lang.String productName)` Clears all preferences set for registered `TileEncoderFactory`s under the given formatName and productName in the given `OperationRegistry`.
`static TileEncoder` `create(OperationRegistry registry, java.lang.String formatName, java.io.OutputStream output, TileCodecParameterList paramList, java.awt.image.SampleModel sampleModel)` Creates a `TileEncoder` for the specified format that is capable of handling the supplied arguments.
`static void` `encode(OperationRegistry registry, java.lang.String formatName, java.awt.image.Raster raster, java.io.OutputStream output, TileCodecParameterList param)` Encodes the given `Raster` using the given formatName and `TileCodecParameterList` and writes the encoded data to the specified `OutputStream`.
`static TileEncoderFactory` `get(OperationRegistry registry, java.lang.String formatName)` Returns the the most preferred `TileEncoderFactory` object registered against the given format name.
`static java.util.Iterator` `getIterator(OperationRegistry registry, java.lang.String formatName)` Returns an `Iterator` over all `TileEncoderFactory` objects registered under the given format name over all products.
`static java.util.List` `getOrderedList(OperationRegistry registry, java.lang.String formatName, java.lang.String productName)` Returns a List of the `TileEncoderFactory`s registered in the given `OperationRegistry` under the given formatName and productName, in an ordering that satisfies all of the pairwise preferences that have been set.
`static void` `register(OperationRegistry registry, java.lang.String formatName, java.lang.String productName, TileEncoderFactory tef)` Registers the given `TileEncoderFactory` with the given `OperationRegistry` under the given formatName and productName.
`static void` `setPreference(OperationRegistry registry, java.lang.String formatName, java.lang.String productName, TileEncoderFactory preferredTEF, TileEncoderFactory otherTEF)` Sets a preference between the given two `TileEncoderFactory` objects in the given `OperationRegistry` under the given formatName and productName.
`static void` `unregister(OperationRegistry registry, java.lang.String formatName, java.lang.String productName, TileEncoderFactory tef)` Unregisters the given `TileEncoderFactory` previously registered under the given formatName and productName in the given `OperationRegistry`.
`static void` `unsetPreference(OperationRegistry registry, java.lang.String formatName, java.lang.String productName, TileEncoderFactory preferredTEF, TileEncoderFactory otherTEF)` Unsets a preference previously set amongst the given two `TileEncoderFactory` objects in the given `OperationRegistry` under the given formatName and productName.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### TileEncoderRegistry

    public TileEncoderRegistry()

Method Detail

### register

    public static void register(OperationRegistry registry,
                                java.lang.String formatName,
                                java.lang.String productName,
                                TileEncoderFactory tef)

  Registers the given `TileEncoderFactory` with the given `OperationRegistry` under the given formatName and productName.
  Parameters:
    `registry` - The `OperationRegistry` to register the `TileEncoderFactory` with.
    `formatName` - The formatName to register the `TileEncoderFactory` under.
    `productName` - The productName to register the `TileEncoderFactory` under.
    `tef` - The `TileEncoderFactory` to register.
  Throws:
    `java.lang.IllegalArgumentException` - if formatName is null.
    `java.lang.IllegalArgumentException` - if productName is null.
    `java.lang.IllegalArgumentException` - if tef is null.
    `java.lang.IllegalArgumentException` - if there is no `TileCodecDescriptor` registered against the given `formatName`.

### unregister

    public static void unregister(OperationRegistry registry,
                                  java.lang.String formatName,
                                  java.lang.String productName,
                                  TileEncoderFactory tef)

  Unregisters the given `TileEncoderFactory` previously registered under the given formatName and productName in the given `OperationRegistry`.
  Parameters:
    `registry` - The `OperationRegistry` to unregister the `TileEncoderFactory` from.
    `formatName` - The formatName to unregister the `TileEncoderFactory` from.
    `productName` - The productName to unregister the `TileEncoderFactory` from.
    `tef` - The `TileEncoderFactory` to unregister.
  Throws:
    `java.lang.IllegalArgumentException` - if formatName is null.
    `java.lang.IllegalArgumentException` - if productName is null.
    `java.lang.IllegalArgumentException` - if tef is null.
    `java.lang.IllegalArgumentException` - if there is no `TileCodecDescriptor` registered against the given `formatName`.
    `java.lang.IllegalArgumentException` - if the tef was not previously registered against the given formatName and productName.

### setPreference

    public static void setPreference(OperationRegistry registry,
                                     java.lang.String formatName,
                                     java.lang.String productName,
                                     TileEncoderFactory preferredTEF,
                                     TileEncoderFactory otherTEF)

  Sets a preference between the given two `TileEncoderFactory` objects in the given `OperationRegistry` under the given formatName and productName.
  Parameters:
    `registry` - The `OperationRegistry` to set preferences on.
    `formatName` - The formatName of the two `TileEncoderFactory`s.
    `productName` - The productName of the two `TileEncoderFactory`s.
    `preferredTEF` - The preferred `TileEncoderFactory`.
    `otherTEF` - The other `TileEncoderFactory`.
  Throws:
    `java.lang.IllegalArgumentException` - if formatName is null.
    `java.lang.IllegalArgumentException` - if productName is null.
    `java.lang.IllegalArgumentException` - if preferredTEF is null.
    `java.lang.IllegalArgumentException` - if otherTEF is null.
    `java.lang.IllegalArgumentException` - if there is no `TileCodecDescriptor` registered against the given `formatName`.
    `java.lang.IllegalArgumentException` - if either of the two tef's was not previously registered against formatName and productName.

### unsetPreference

    public static void unsetPreference(OperationRegistry registry,
                                       java.lang.String formatName,
                                       java.lang.String productName,
                                       TileEncoderFactory preferredTEF,
                                       TileEncoderFactory otherTEF)

  Unsets a preference previously set amongst the given two `TileEncoderFactory` objects in the given `OperationRegistry` under the given formatName and productName.
  Parameters:
    `registry` - The `OperationRegistry` to unset preferences on.
    `formanName` - The formatName of the two `TileEncoderFactory`s.
    `productName` - The productName of the two `TileEncoderFactory`s.
    `preferredTEF` - The preferred `TileEncoderFactory`.
    `otherTEF` - The other `TileEncoderFactory`.
  Throws:
    `java.lang.IllegalArgumentException` - if formatName is null.
    `java.lang.IllegalArgumentException` - if productName is null.
    `java.lang.IllegalArgumentException` - if preferredTEF is null.
    `java.lang.IllegalArgumentException` - if otherTEF is null.
    `java.lang.IllegalArgumentException` - if there is no `TileCodecDescriptor` registered against the given `formatName`.
    `java.lang.IllegalArgumentException` - if either of the two tef's was not previously registered against formatName and productName.

### clearPreferences

    public static void clearPreferences(OperationRegistry registry,
                                        java.lang.String formatName,
                                        java.lang.String productName)

  Clears all preferences set for registered `TileEncoderFactory`s under the given formatName and productName in the given `OperationRegistry`.
  Parameters:
    `registry` - The `OperationRegistry` to clear preferences from.
    `formatName` - The format name to clear preferences under.
    `productName` - The productName to clear preferences under.
  Throws:
    `java.lang.IllegalArgumentException` - if formatName is null.
    `java.lang.IllegalArgumentException` - if productName is null.
    `java.lang.IllegalArgumentException` - if there is no `TileCodecDescriptor` registered against the given `formatName`.

### getOrderedList

    public static java.util.List getOrderedList(OperationRegistry registry,
                                                java.lang.String formatName,
                                                java.lang.String productName)

  Returns a List of the `TileEncoderFactory`s registered in the given `OperationRegistry` under the given formatName and productName, in an ordering that satisfies all of the pairwise preferences that have been set. Cycles will be broken in an arbitrary manner.
  Parameters:
    `registry` - The `OperationRegistry` to clear preferences from.
    `formatName` - The format name to clear preferences under.
    `productName` - The productName to clear preferences under.
  Throws:
    `java.lang.IllegalArgumentException` - if formatName is null.
    `java.lang.IllegalArgumentException` - if productName is null.
    `java.lang.IllegalArgumentException` - if there is no `TileCodecDescriptor` registered against the given `formatName`.

### getIterator

    public static java.util.Iterator getIterator(OperationRegistry registry,
                                                 java.lang.String formatName)

  Returns an `Iterator` over all `TileEncoderFactory` objects registered under the given format name over all products. The order of the `TileEncoderFactory` objects in the iteration will be according to the pairwise preferences among products and `TileEncoderFactory` objects within a product. The `remove()` method of the `Iterator` may not be implemented.
  Parameters:
    `registry` - The `OperationRegistry` to use.
    `formatName` - The format name.
  Returns:
    an `Iterator` over `TileEncoderFactory` objects.
  Throws:
    `java.lang.IllegalArgumentException` - if formatName is `null`
    `java.lang.IllegalArgumentException` - if there is no `TileCodecDescriptor` registered against the `formatName`.
  Since:
    JAI 1.1

### get

    public static TileEncoderFactory get(OperationRegistry registry,
                                         java.lang.String formatName)

  Returns the the most preferred `TileEncoderFactory` object registered against the given format name. This method will return the first `TileEncoderFactory` that would be encountered by the `Iterator` returned by the `getIterator()` method.
  Parameters:
    `registry` - The `OperationRegistry` to use. If this is `null`, then `JAI.getDefaultInstance().getOperationRegistry()` will be used.
    `formatName` - The format name as a `String`
  Returns:
    a registered `TileEncoderFactory` object
  Throws:
    `java.lang.IllegalArgumentException` - if formatName is `null`.
    `java.lang.IllegalArgumentException` - if there is no `TileCodecDescriptor` registered against the `formatName`

### create

    public static TileEncoder create(OperationRegistry registry,
                                     java.lang.String formatName,
                                     java.io.OutputStream output,
                                     TileCodecParameterList paramList,
                                     java.awt.image.SampleModel sampleModel)

  Creates a `TileEncoder` for the specified format that is capable of handling the supplied arguments.

  The preferences set amongst the `TileEncoderFactory` objects registered with the `OperationRegistry` are used to select the most prefered `TileEncoderFactory` whose `createEncoder()` method returns a non-null value.

  Parameters:
    `registry` - The `OperationRegistry` to use to create the `TileEncoder`.
    `formatName` - The format for which the `TileEncoder` is to be created.
    `output` - The `OutputStream` to write encoded data to.
    `paramList` - The object containing the tile encoding parameters.
    `sampleModel` - The `SampleModel` of the `Raster` to be encoded.
  Throws:
    `java.lang.IllegalArgumentException` - if formatName is null.
    `java.lang.IllegalArgumentException` - if output is null.
    `java.lang.IllegalArgumentException` - if sampleModel is null.
    `java.lang.IllegalArgumentException` - if there is no `TileCodecDescriptor` registered against the given `formatName`.

### encode

    public static void encode(OperationRegistry registry,
                              java.lang.String formatName,
                              java.awt.image.Raster raster,
                              java.io.OutputStream output,
                              TileCodecParameterList param)
                       throws java.io.IOException

  Encodes the given `Raster` using the given formatName and `TileCodecParameterList` and writes the encoded data to the specified `OutputStream`. The `TileEncoder` which performs the encoding is the one created from the most prefered `TileEncoderFactory` whose `create` method returns a non-null result. If there are no `TileEncoder` objects that can encode the specified `Raster` according to the encoding parameters supplied, nothing will be written to the specified `OutputStream`.

  If the specified `TileCodecParameterList` is null, the default `TileCodecParameterList` retrieved by the specific `TileEncoder.getDefaultParameters()` method for the "tileEncoder" registry mode will be used.

  If multiple tiles are to be encoded to the same `OutputStream` in the same format using the same `TileCodecParameterList`, it is advisable to create a `TileEncoder` object and use the `encode()` method on this encoder to encode each tile, thus creating and using only a single `TileEncoder` object. The `encode()` method on `TileEncoderRegistry` creates a new `TileEncoder` object each time it is called.

  Parameters:
    `registry` - The `OperationRegistry` to use to create the `TileEncoder`.
    `formatName` - The name of the format to encode the data in.
    `raster` - The `Raster` to be encoded.
    `output` - The `OutputStream` to write the encoded data to.
    `param` - The `TileCodecParameterList` to be used.
  Returns:
    The associated `TileEncoder`, or `null`.
  Throws:
    `java.lang.IllegalArgumentException` - if formatName is null.
    `java.lang.IllegalArgumentException` - if raster is null.
    `java.lang.IllegalArgumentException` - if output is null.
    `java.io.IOException` - if an input/output error occurs during the encoding.
    `java.lang.IllegalArgumentException` - if there is no `TileCodecDescriptor` registered against the given `formatName`.