rabbit.handler.convert
Class ExternalProcessConverter

java.lang.Object
  extended by rabbit.handler.convert.ExternalProcessConverter
All Implemented Interfaces:
ImageConverter

public class ExternalProcessConverter
extends Object
implements ImageConverter

An image converter that runs an external program to do the actual conversion.


Constructor Summary
ExternalProcessConverter(SProperties props)
          Create a new ExternalProcessConverter configured from the given properties.
 
Method Summary
 boolean canConvert()
          Check if this image converter can do any work.
 void closeStreams(Process ps)
          Close the streams to the external process.
 void convertImage(File from, File to, String info)
          Convert an image.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExternalProcessConverter

public ExternalProcessConverter(SProperties props)
Create a new ExternalProcessConverter configured from the given properties.

Parameters:
props - the configuration for this converter
Method Detail

canConvert

public boolean canConvert()
Description copied from interface: ImageConverter
Check if this image converter can do any work.

Specified by:
canConvert in interface ImageConverter
Returns:
true if this image converter can convert.

convertImage

public void convertImage(File from,
                         File to,
                         String info)
                  throws IOException
Description copied from interface: ImageConverter
Convert an image.

Specified by:
convertImage in interface ImageConverter
Parameters:
from - the File that holds the source image
to - the File to store the converted image in
info - some identifier for the image (typically the uri)
Throws:
IOException - if the image conversion fails

closeStreams

public void closeStreams(Process ps)
                  throws IOException
Close the streams to the external process.

Parameters:
ps - the Process that did the image conversion
Throws:
IOException - if close fails