DEPRECATED
Object
com.bea.p13n.content.document.ref.loader.LoaderFilter
BulkLoader filter which can determine "width" and "height" metadata for GIF, JPEG, XBM, and PNG image files.
The image type is determined from the file name (based upon the
MimeTypeHelper
).
This class will generally not read in the entire contents of the file. It will instead attempt to get the metadata from the image format headers. However, it does not implement full decoders for the image formats, so, there might be images files for which this doesn't work.
Object
ImageLoaderFilter
com.bea.p13n.content.document.ref.loader.LoaderFilter
Constructor Summary |
Method Summary |
public static void |
|
public static void |
|
public static void |
|
public static void |
|
public void |
|
public static void | |
public static int |
|
Methods from class java.lang. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods from interface com.bea.p13n.content.document.ref.loader. |
|
Constructor Detail |
public ImageLoaderFilter()
Method Detail |
public static void handleGIF(Get the metadata for a GIF file.File
f,Properties
p,BulkLoader
loader)
throwsIOException
This will get "width" and "height".
This only supports standard GIF89a and GIF87a formats where the size is encoded in bytes 6-9 (i.e. after the 'GIF89a' header).
IOException
public static void handleJPEG(Get the metadata for a JPEG file.File
f,Properties
p,BulkLoader
loader)
throwsIOException
This will get "width" and "height".
This gets the size from the Start of Frame for Baseline DCT section (designated by the 0xff 0xc0 marker).
IOException
public static void handlePNG(Get the metadata for a PNG file.File
f,Properties
p,BulkLoader
loader)
throwsIOException
This will get "width" and "height".
IOException
public static void handleXBM(Get the metadata for a XBM file.File
f,Properties
p,BulkLoader
loader)
throwsIOException
This will get "width" and "height".
This uses a regular expression to find the width and height. It will ignore comments, although it won't ignore a width and height which are contained within a comments block.
IOException
public void loadProperties(Fill out the properties with image metadata from the specified file.File
f,Properties
p,BulkLoader
loader)
If the filename doesn't correspond to a GIF, JPEG, XBM, or PNG, it will be ignored.
public static void main(Print the sizes of the files specified on the command-line.String
[] args)
throwsException
Exception
public static int toInt(byte b)Safely convert a byte to an int (with high bytes set to 0).