org.apache.xmlgraphics.image.loader.impl.imageio

## Class PreloaderImageIO

- java.lang.Object
- - org.apache.xmlgraphics.image.loader.impl.AbstractImagePreloader
  - - org.apache.xmlgraphics.image.loader.impl.imageio.PreloaderImageIO

- All Implemented Interfaces:
    ImagePreloader

      public class PreloaderImageIO
      extends AbstractImagePreloader

  Image preloader for images supported by ImageIO.

  Note: The implementation relies on the presence of a working ImageIO implementation which provides accurate image metadata. This is particularly important for PNG image because the PNG loader relies on that.

- - ### Field Summary

    - ### Fields inherited from interface org.apache.xmlgraphics.image.loader.spi.ImagePreloader

      `DEFAULT_PRIORITY`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PreloaderImageIO()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getPriority()` Returns the priority of the preloader.
    `ImageInfo` | `preloadImage(java.lang.String uri, javax.xml.transform.Source src, ImageContext context)` "Preloads" an image, i.e.

    - ### Methods inherited from class org.apache.xmlgraphics.image.loader.impl.AbstractImagePreloader

      `getHeader`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### PreloaderImageIO

          public PreloaderImageIO()

  - ### Method Detail

    - #### preloadImage

          public ImageInfo preloadImage(java.lang.String uri,
                                        javax.xml.transform.Source src,
                                        ImageContext context)
                                 throws java.io.IOException,
                                        ImageException

      "Preloads" an image, i.e. indentifies whether the source image is supported by this implementation and determines the image's intrinsic size and possibly some additional information. The image is usually not fully loaded at this time to conserve memory. The method returns null if the image was not identified. An `ImageException` is only thrown if the image is identified but some error has happened while working on the file.
      Parameters:
        `uri` - the original (unresolved) URI of the image
        `src` - a image source the image is loaded from
        `context` - the context object that provides configuration information
      Returns:
        an image info object with the basic information about an image or null if the image is not supported by this implementation
      Throws:
        `ImageException`
        `java.io.IOException` - if an I/O error occurs while preloading the image

    - #### getPriority

          public int getPriority()

      Returns the priority of the preloader. The lower the value, the higher the preloader's priority.
      Specified by:
        `getPriority` in interface `ImagePreloader`
      Overrides:
        `getPriority` in class `AbstractImagePreloader`
      Returns:
        an integer (default is 1000)

Copyright 1999-2025 The Apache Software Foundation. All Rights Reserved.