loci.formats.cache

## Class CacheSource

- java.lang.Object
- - loci.formats.cache.CacheSource

- All Implemented Interfaces:
    ICacheSource
  Direct Known Subclasses:
    ByteArraySource

      public abstract class CacheSource
      extends java.lang.Object
      implements ICacheSource

  Superclass of cache sources that retrieve image planes from a data source (e.g., a file) using Bio-Formats.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected IFormatReader` | `reader` Reader from which to draw image planes.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CacheSource(IFormatReader r)` Constructs a cache source from the given Bio-Formats reader.
    `CacheSource(java.lang.String id)` Constructs a cache source that draws from the given file.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract java.lang.Object` | `getObject(int index)` Get the object corresponding to the given index.
    `int` | `getObjectCount()` Get the total number of objects that this source can retrieve.

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

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

- - ### Field Detail

    - #### reader

          protected IFormatReader reader

      Reader from which to draw image planes.

  - ### Constructor Detail

    - #### CacheSource

          public CacheSource(IFormatReader r)

      Constructs a cache source from the given Bio-Formats reader.

    - #### CacheSource

          public CacheSource(java.lang.String id)
                      throws CacheException

      Constructs a cache source that draws from the given file.
      Throws:
        `CacheException`

  - ### Method Detail

    - #### getObjectCount

          public int getObjectCount()

      Description copied from interface: `ICacheSource`
      Get the total number of objects that this source can retrieve.
      Specified by:
        `getObjectCount` in interface `ICacheSource`

    - #### getObject

          public abstract java.lang.Object getObject(int index)
                                              throws CacheException

      Description copied from interface: `ICacheSource`
      Get the object corresponding to the given index.
      Specified by:
        `getObject` in interface `ICacheSource`
      Throws:
        `CacheException`

Copyright © 2026 Open Microscopy Environment