Class ImageHandler

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

public final class ImageHandler extends Object
Understands base64 encoding and decoding of an image.
  • Field Details

    • EMPTY_STRING

      private static final String EMPTY_STRING
      See Also:
    • logger

      private static Logger logger
    • imageEncoder

      private static ImageEncoder imageEncoder
    • imageDecoder

      private static ImageDecoder imageDecoder
    • imageFileWriter

      private static org.fest.swing.image.ImageFileWriter imageFileWriter
  • Constructor Details

    • ImageHandler

      private ImageHandler()
  • Method Details

    • 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.
    • encodeBase64

      static String encodeBase64(BufferedImage image, ImageEncoder encoder)
    • 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.
    • decodeBase64

      static BufferedImage decodeBase64(String encoded, ImageDecoder decoder)
    • 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.
    • decodeBase64AndSaveAsPng

      static String decodeBase64AndSaveAsPng(String encoded, String path, ImageDecoder decoder, org.fest.swing.image.ImageFileWriter writer)