org.fest.swing.junit.ant
Class ImageHandler

java.lang.Object
  extended by org.fest.swing.junit.ant.ImageHandler

public final class ImageHandler
extends Object

Understands base64 encoding and decoding of an image.

Author:
Alex Ruiz

Method Summary
static BufferedImage decodeBase64(String encoded)
          Decodes the given base64 characters into an image.
static String decodeBase64AndSaveAsPng(String encoded, String path)
          Decodes the given base64 characters into an image, and saves the decoded image as a file using the given path.
static String encodeBase64(BufferedImage image)
          Encodes the given image using the base64 algorithm.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

encodeBase64

public static String encodeBase64(BufferedImage image)
Encodes the given image using the base64 algorithm. Failures in encoding an image are simply logged, no exceptions are thrown.

Parameters:
image - the image to encode.
Returns:
base64 characters.

decodeBase64

public static BufferedImage decodeBase64(String encoded)
Decodes the given base64 characters into an image. Failures in decoding base64 characters are simply logged, no exceptions are thrown.

Parameters:
encoded - the given base64 characters.
Returns:
the decoded image.

decodeBase64AndSaveAsPng

public static String decodeBase64AndSaveAsPng(String encoded,
                                              String path)
Decodes the given base64 characters into an image, and saves the decoded image as a file using the given path. Failures in decoding or saving the image as a file are simply logged, no exceptions are thrown.

Parameters:
encoded - the given base64 characters.
path - the path where to save the image file.
Returns:
empty String. This method is used by this extensions XSL stylesheets to decode the image in the XML report.


Copyright © 2007-2010 FEST (Fixtures for Easy Software Testing). All Rights Reserved.