de.vc.jfo.tools

## Class NativeCmdImageTranscode

- java.lang.Object
- - de.vc.jfo.tools.ImageTranscoder
  - - de.vc.jfo.tools.NativeCmdImageTranscode

- Direct Known Subclasses:
    ImageConverter

      public class NativeCmdImageTranscode
      extends ImageTranscoder

  This image transcode executes a native (Windows, Unix specific) command to convert an image into another format. Therefore this image transcoder has a command-template with parameters, introduced by a question mark, that are filled in before execution. A command-template can have following parameters:
  - ?i Name of input/source file.
  - ?o Name of output/destination file
  Example for a command an Windows:

  c:/programme/graphic/IrfanView/i_view32.exe ?i /convert=?o

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `NativeCmdImageTranscode(java.lang.String[] inputFormats, java.lang.String outputFormat, java.lang.String cmd)` Constructs a new image transcode.
    `NativeCmdImageTranscode(java.lang.String inputFormat, java.lang.String outputFormat, java.lang.String cmd)` Constructs a new image transcode.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `doTranscode(java.io.InputStream input, java.io.OutputStream destination, ImageMetaData descriptor)` Do transcode an image from an input stream to an output stream.
    `protected void` | `doTranscode(java.lang.String inputFile, java.lang.String outputFile, ImageMetaData descriptor)` Do transcode an image from an input file to an output file.
    `java.lang.String` | `getCommand()` Gets the command that is executed by this transcode when an image must be converted.
    `java.lang.String[]` | `getInputFormats()` Gets the input format of images that are accepted by this trancoder.
    `java.lang.String` | `getOutputFormat()` Gets the output format of the produced image.
    `boolean` | `isReady()` Checks if this transcode is ready to run.
    `java.lang.String` | `toString()`

    - ### Methods inherited from class de.vc.jfo.tools.ImageTranscoder

      `canTranscodeFile, canTranscodeFormat, checkImageSize, getMaximumSize, getTypeOfFile, setMaximumSize, transcodeBytes, transcodeFile, transcodeFile`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### NativeCmdImageTranscode

          public NativeCmdImageTranscode(java.lang.String inputFormat,
                                 java.lang.String outputFormat,
                                 java.lang.String cmd)

      Constructs a new image transcode.
      Parameters:
        `inputFormat` - Input format that is supported by this transcoder.
        `outputFormat` - Output format that is produced by this transcoder.
        `cmd` - Command template.

    - #### NativeCmdImageTranscode

          public NativeCmdImageTranscode(java.lang.String[] inputFormats,
                                 java.lang.String outputFormat,
                                 java.lang.String cmd)

      Constructs a new image transcode.
      Parameters:
        `inputFormats` - Array of input formats that are supported by this transcoder.
        `outputFormat` - Output format that is produced by this transcoder.
        `cmd` - Command template.

  - ### Method Detail

    - #### getOutputFormat

          public java.lang.String getOutputFormat()

      Description copied from class: `ImageTranscoder`
      Gets the output format of the produced image. The format must be a subtype of image, e.g. png or bmp.
      Specified by:
        `getOutputFormat` in class `ImageTranscoder`
      Returns:
        Output format.

    - #### getInputFormats

          public java.lang.String[] getInputFormats()

      Description copied from class: `ImageTranscoder`
      Gets the input format of images that are accepted by this trancoder. The format must be a MIME subtype of image, e.g. png or bmp.
      Specified by:
        `getInputFormats` in class `ImageTranscoder`
      Returns:
        Input format.

    - #### getCommand

          public java.lang.String getCommand()

      Gets the command that is executed by this transcode when an image must be converted.
      Returns:
        Command.

    - #### isReady

          public boolean isReady()

      Description copied from class: `ImageTranscoder`
      Checks if this transcode is ready to run. Normally always true is returned.
      Overrides:
        `isReady` in class `ImageTranscoder`
      Returns:
        `true`

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

    - #### doTranscode

          protected void doTranscode(java.lang.String inputFile,
                         java.lang.String outputFile,
                         ImageMetaData descriptor)

      Description copied from class: `ImageTranscoder`
      Do transcode an image from an input file to an output file.
      Specified by:
        `doTranscode` in class `ImageTranscoder`
      Parameters:
        `inputFile` - Input file.
        `outputFile` - Output file.
        `descriptor` - ImageDescriptor

    - #### doTranscode

          protected void doTranscode(java.io.InputStream input,
                         java.io.OutputStream destination,
                         ImageMetaData descriptor)

      Description copied from class: `ImageTranscoder`
      Do transcode an image from an input stream to an output stream. You don't have to close the streams.
      Specified by:
        `doTranscode` in class `ImageTranscoder`
      Parameters:
        `input` - InputStream
        `destination` - OutputStream
        `descriptor` - ImageDescriptor

© 2003-2011 by Sascha Schmidt (vision-cloud.de). All Rights Reserved.