© 2005 BEA Systems, Inc.

com.bea.p13n.content.document.ref.loader
Class ImageLoaderFilter

java.lang.Object
  extended bycom.bea.p13n.content.document.ref.loader.ImageLoaderFilter
All Implemented Interfaces:
LoaderFilter

public class ImageLoaderFilter
extends Object
implements 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 MIME type).

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.

Since:
3.1

Constructor Summary
ImageLoaderFilter()
          Deprecated.  
 
Method Summary
static void handleGIF(File f, Properties p, BulkLoader loader)
          Deprecated. Get the metadata for a GIF file.
static void handleJPEG(File f, Properties p, BulkLoader loader)
          Deprecated. Get the metadata for a JPEG file.
static void handlePNG(File f, Properties p, BulkLoader loader)
          Deprecated. Get the metadata for a PNG file.
static void handleXBM(File f, Properties p, BulkLoader loader)
          Deprecated. Get the metadata for a XBM file.
 void loadProperties(File f, Properties p, BulkLoader loader)
          Deprecated. Fill out the properties with image metadata from the specified file.
static void main(String[] args)
          Deprecated. Print the sizes of the files specified on the command-line.
static int toInt(byte b)
          Deprecated. Safely convert a byte to an int (with high bytes set to 0).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImageLoaderFilter

public ImageLoaderFilter()
Deprecated. 
Method Detail

handleGIF

public static void handleGIF(File f,
                             Properties p,
                             BulkLoader loader)
                      throws IOException
Deprecated. 
Get the metadata for a GIF file.

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).

Throws:
IOException

handleJPEG

public static void handleJPEG(File f,
                              Properties p,
                              BulkLoader loader)
                       throws IOException
Deprecated. 
Get the metadata for a JPEG file.

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).

Throws:
IOException

handlePNG

public static void handlePNG(File f,
                             Properties p,
                             BulkLoader loader)
                      throws IOException
Deprecated. 
Get the metadata for a PNG file.

This will get "width" and "height".

Throws:
IOException

handleXBM

public static void handleXBM(File f,
                             Properties p,
                             BulkLoader loader)
                      throws IOException
Deprecated. 
Get the metadata for a XBM file.

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.

Throws:
IOException

loadProperties

public void loadProperties(File f,
                           Properties p,
                           BulkLoader loader)
Deprecated. 
Fill out the properties with image metadata from the specified file.

If the filename doesn't correspond to a GIF, JPEG, XBM, or PNG, it will be ignored.

Specified by:
loadProperties in interface LoaderFilter

main

public static void main(String[] args)
                 throws Exception
Deprecated. 
Print the sizes of the files specified on the command-line.

Throws:
Exception

toInt

public static int toInt(byte b)
Deprecated. 
Safely convert a byte to an int (with high bytes set to 0).


© 2005 BEA Systems, Inc.

Copyright © 2005 BEA Systems, Inc. All Rights Reserved