net.sf.jasperreports.engine.util
Class JRTypeSniffer

java.lang.Object
  extended by net.sf.jasperreports.engine.util.JRTypeSniffer

public final class JRTypeSniffer
extends java.lang.Object

Version:
$Id: JRTypeSniffer.java 5180 2012-03-29 13:23:12Z teodord $
Author:
George Stojanoff (gstojanoff@jaspersoft.com), Flavius Sana (flavius_sana@users.sourceforge.net)

Method Summary
static java.lang.String getImageMimeType(byte imageType)
          Deprecated. Replaced by ImageTypeEnum.
static byte getImageType(byte[] data)
          Deprecated. Replaced by getImageTypeValue(byte[]).
static ImageTypeEnum getImageTypeValue(byte[] data)
           
static boolean isGIF(byte[] data)
          Sniffs an incoming byte array to see if the first 3 characters are GIF.
static boolean isJPEG(byte[] data)
          Sniffs an incoming byte array to see if the starting value is 0xffd8 which is the "header" for JPEG data Note: This method only really needs the first 2 bytes.
static boolean isPNG(byte[] data)
          Sniffs an incoming byte array to see if the first eight bytes are the following (decimal) values: 137 80 78 71 13 10 26 10 which is the "signature" for PNG data See http://www.w3.org/TR/PNG/#5PNG-file-signature for more details.
static boolean isTIFF(byte[] data)
          Sniffs an incoming byte array to see if the starting value is 0x4949 (little endian) or 0x4D4D (big endian) which is the "header" for TIFF data The TIFF standards supports both endians.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isGIF

public static boolean isGIF(byte[] data)
Sniffs an incoming byte array to see if the first 3 characters are GIF. This is also known as the GIF signiture. See http://www.dcs.ed.ac.uk/home/mxr/gfx/2d/GIF87a.txt for more details Note: Perhaps we should be checking for the more restive string GIF87a but I am not sure if older GIF images are sill out there in use on the web. Note: This method only really needs the first 3 bytes.


isJPEG

public static boolean isJPEG(byte[] data)
Sniffs an incoming byte array to see if the starting value is 0xffd8 which is the "header" for JPEG data Note: This method only really needs the first 2 bytes.


isPNG

public static boolean isPNG(byte[] data)
Sniffs an incoming byte array to see if the first eight bytes are the following (decimal) values: 137 80 78 71 13 10 26 10 which is the "signature" for PNG data See http://www.w3.org/TR/PNG/#5PNG-file-signature for more details. Note: This method only really needs the first 8 bytes.


isTIFF

public static boolean isTIFF(byte[] data)
Sniffs an incoming byte array to see if the starting value is 0x4949 (little endian) or 0x4D4D (big endian) which is the "header" for TIFF data The TIFF standards supports both endians. See http://palimpsest.stanford.edu/bytopic/imaging/std/tiff5.html for more details. Note: This method only really needs the first 2 bytes.


getImageType

public static byte getImageType(byte[] data)
Deprecated. Replaced by getImageTypeValue(byte[]).


getImageTypeValue

public static ImageTypeEnum getImageTypeValue(byte[] data)

getImageMimeType

public static java.lang.String getImageMimeType(byte imageType)
Deprecated. Replaced by ImageTypeEnum.



© 2001-2010 Jaspersoft Corporation www.jaspersoft.com