Package org.pentaho.reporting.libraries.resourceloader.cache

## Class CachingResourceBundleData

- java.lang.Object
- - org.pentaho.reporting.libraries.resourceloader.cache.CachingResourceBundleData

- All Implemented Interfaces:
    `java.io.Serializable`, `ResourceBundleData`, `ResourceData`

      public class CachingResourceBundleData
      extends java.lang.Object
      implements ResourceBundleData, java.io.Serializable

  A very simple implementation which is suitable for smaller objects. The complete data is read into memory.
  Author:
    Thomas Morgner
  See Also:
    Serialized Form

- - ### Field Summary

    - ### Fields inherited from interface org.pentaho.reporting.libraries.resourceloader.ResourceData

      `CONTENT_LENGTH, CONTENT_TYPE, FILENAME`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `CachingResourceBundleData​(ResourceBundleData data)` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static ResourceBundleData` | `createCached​(ResourceBundleData data)` |
    `ResourceBundleData` | `deriveData​(ResourceKey key)` |
    `ResourceManager` | `deriveManager​(ResourceManager parent)` |
    `java.lang.Object` | `getAttribute​(java.lang.String key)` |
    `ResourceBundleData` | `getBackend()` |
    `ResourceKey` | `getBundleKey()` |
    `ResourceKey` | `getKey()` |
    `long` | `getLength()` |
    `byte[]` | `getResource​(ResourceManager caller)` | This is dangerous, especially if the resource is large.
    `int` | `getResource​(ResourceManager caller, byte[] target, long offset, int length)` | Tries to read data into the given byte-array.
    `java.io.InputStream` | `getResourceAsStream​(ResourceManager caller)` |
    `long` | `getVersion​(ResourceManager caller)` |

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

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

- - ### Constructor Detail

    - #### CachingResourceBundleData

          public CachingResourceBundleData​(ResourceBundleData data)

  - ### Method Detail

    - #### getResourceAsStream

          public java.io.InputStream getResourceAsStream​(ResourceManager caller)
                                                  throws ResourceLoadingException

      Specified by:
        `getResourceAsStream` in interface `ResourceData`
      Throws:
        `ResourceLoadingException`

    - #### getLength

          public long getLength()

      Specified by:
        `getLength` in interface `ResourceData`

    - #### getResource

          public byte[] getResource​(ResourceManager caller)
                             throws ResourceLoadingException

      Description copied from interface: `ResourceData`
      This is dangerous, especially if the resource is large.
      Specified by:
        `getResource` in interface `ResourceData`
      Returns:
      Throws:
        `ResourceLoadingException`

    - #### getResource

          public int getResource​(ResourceManager caller,
                                 byte[] target,
                                 long offset,
                                 int length)
                          throws ResourceLoadingException

      Description copied from interface: `ResourceData`
      Tries to read data into the given byte-array.
      Specified by:
        `getResource` in interface `ResourceData`
      Returns:
        the number of bytes read or -1 if no more data can be read.
      Throws:
        `ResourceLoadingException`

    - #### getAttribute

          public java.lang.Object getAttribute​(java.lang.String key)

      Specified by:
        `getAttribute` in interface `ResourceData`

    - #### getKey

          public ResourceKey getKey()

      Specified by:
        `getKey` in interface `ResourceData`

    - #### getVersion

          public long getVersion​(ResourceManager caller)
                          throws ResourceLoadingException

      Specified by:
        `getVersion` in interface `ResourceData`
      Throws:
        `ResourceLoadingException`

    - #### getBundleKey

          public ResourceKey getBundleKey()

      Specified by:
        `getBundleKey` in interface `ResourceBundleData`

    - #### deriveData

          public ResourceBundleData deriveData​(ResourceKey key)
                                        throws ResourceLoadingException

      Specified by:
        `deriveData` in interface `ResourceBundleData`
      Throws:
        `ResourceLoadingException`

    - #### deriveManager

          public ResourceManager deriveManager​(ResourceManager parent)
                                        throws ResourceLoadingException

      Specified by:
        `deriveManager` in interface `ResourceBundleData`
      Throws:
        `ResourceLoadingException`

    - #### getBackend

          public ResourceBundleData getBackend()

    - #### createCached

          public static ResourceBundleData createCached​(ResourceBundleData data)