org.jfree.report.util
Class ImageComparator

java.lang.Object
  extended byorg.jfree.report.util.ImageComparator

public class ImageComparator
extends java.lang.Object

The ImageComparator tries to compare a byte[] for equality by creating 2 hashes for the bytearray and comparing thoose hashes. If no digest algorithms are available, then the complete byte[] is used for comparison.

Author:
Thomas Morgner

Constructor Summary
ImageComparator()
          Creates a new ImageComparator.
 
Method Summary
 java.lang.Object createCompareData(byte[] image, boolean fast)
          Creates 2 comparable objects.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImageComparator

public ImageComparator()
Creates a new ImageComparator. The comparator checks whether the MD5 and the SHA message digest implementations are available. If they are not available, an alternative comparison method is used, which is more memory consuming.

Method Detail

createCompareData

public java.lang.Object createCompareData(byte[] image,
                                          boolean fast)
Creates 2 comparable objects. These objects can be compared for equality, but cannot be modified any else.

Parameters:
image - the image data which should be prepared for comparison
fast - whether to prefer the memory intensive faster compare method to the digest based comparation. This may result in outofmemory errors on huge reports or images.
Returns:
the prepared image data.