Overview | Package | Class | Tree | Deprecated | Index | Help
| © 2002 BEA Systems, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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

    java.lang.Object
      |
      +--com.bea.p13n.content.document.ref.loader.ImageLoaderFilter

public class ImageLoaderFilter
extends java.lang.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()`

Method Summary
`static void` | `handleGIF(java.io.File f, java.util.Properties p, BulkLoader loader)` Get the metadata for a GIF file.
`static void` | `handleJPEG(java.io.File f, java.util.Properties p, BulkLoader loader)` Get the metadata for a JPEG file.
`static void` | `handlePNG(java.io.File f, java.util.Properties p, BulkLoader loader)` Get the metadata for a PNG file.
`static void` | `handleXBM(java.io.File f, java.util.Properties p, BulkLoader loader)` Get the metadata for a XBM file.
`void` | `loadProperties(java.io.File f, java.util.Properties p, BulkLoader loader)` Fill out the properties with image metadata from the specified file.
`static void` | `main(java.lang.String[] args)` Print the sizes of the files specified on the command-line.
`static int` | `toInt(byte b)` 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()

Method Detail

### loadProperties

    public void loadProperties(java.io.File f,
                               java.util.Properties p,
                               BulkLoader loader)

  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

### toInt

    public static int toInt(byte b)

  Safely convert a byte to an int (with high bytes set to 0).

### handleGIF

    public static void handleGIF(java.io.File f,
                                 java.util.Properties p,
                                 BulkLoader loader)
                          throws java.io.IOException

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

### handleJPEG

    public static void handleJPEG(java.io.File f,
                                  java.util.Properties p,
                                  BulkLoader loader)
                           throws java.io.IOException

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

### handleXBM

    public static void handleXBM(java.io.File f,
                                 java.util.Properties p,
                                 BulkLoader loader)
                          throws java.io.IOException

  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.

### handlePNG

    public static void handlePNG(java.io.File f,
                                 java.util.Properties p,
                                 BulkLoader loader)
                          throws java.io.IOException

  Get the metadata for a PNG file.

  This will get "width" and "height".

### main

    public static void main(java.lang.String[] args)
                     throws java.lang.Exception

  Print the sizes of the files specified on the command-line.

Overview | Package | Class | Tree | Deprecated | Index | Help
| © 2002 BEA Systems, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002 BEA Systems, Inc. All Rights Reserved