org.apache.xmlgraphics.image.loader.impl

## Class AbstractImagePreloader

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

- All Implemented Interfaces:
    ImagePreloader
  Direct Known Subclasses:
    PreloaderBMP, PreloaderEMF, PreloaderEPS, PreloaderGIF, PreloaderImageIO, PreloaderJPEG, PreloaderRawPNG, PreloaderTIFF

      public abstract class AbstractImagePreloader
      extends java.lang.Object
      implements ImagePreloader

  Abstract base class for image preloaders. It provides helper methods for often-used tasks.

- - ### Field Summary

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

      `DEFAULT_PRIORITY`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractImagePreloader()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected byte[]` | `getHeader(javax.imageio.stream.ImageInputStream in, int size)` Allows to read an image header (usually just a magic number).
    `int` | `getPriority()` Returns the priority of the preloader.

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

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

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

      `preloadImage`

- - ### Constructor Detail

    - #### AbstractImagePreloader

          public AbstractImagePreloader()

  - ### Method Detail

    - #### getHeader

          protected byte[] getHeader(javax.imageio.stream.ImageInputStream in,
                                     int size)
                              throws java.io.IOException

      Allows to read an image header (usually just a magic number). The InputStream is reset to the position before the header was read.
      Parameters:
        `in` - the ImageInputStream to read from
        `size` - the size of the header
      Returns:
        the loaded header
      Throws:
        `java.io.IOException` - if an I/O error occurs while reading the header

    - #### 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`
      Returns:
        an integer (default is 1000)

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