Package org.pentaho.reporting.libraries.resourceloader

# Interface ResourceData

All Known Subinterfaces:
  `ResourceBundleData`

All Known Implementing Classes:
  `AbstractResourceData`, `CachingResourceBundleData`, `CachingResourceData`, `ClassloaderResourceData`, `FileResourceData`, `RawResourceData`, `URLResourceData`, `ZipResourceData`

public interface ResourceData
A resource data object encapsulates the raw data of an resource at a given point in the past. Any change to the resource increases the version number. Version numbers are not needed to be checked regulary, but must be checked on each call to 'getVersion()'. This definitly does *not* solve the problem of concurrent modifications; if you need to be sure that the resource has not been altered between the last call to 'getVersion' and 'getResource..' external locking mechanism have to be implemented.

Author:
  Thomas Morgner

## Field Summary

Fields
Modifier and Type
Field
Description
`static final String`
`CONTENT_LENGTH`
`static final String`
`CONTENT_TYPE`
`static final String`
`FILENAME`

## Method Summary

Modifier and Type
Method
Description
`Object`
`getAttribute(String key)`
`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.
`InputStream`
`getResourceAsStream(ResourceManager caller)`
`long`
`getVersion(ResourceManager caller)`

## Field Details

### CONTENT_LENGTH

static final String CONTENT_LENGTH

See Also:
  - Constant Field Values

### CONTENT_TYPE

static final String CONTENT_TYPE

See Also:
  - Constant Field Values

### FILENAME

static final String FILENAME

See Also:
  - Constant Field Values

## Method Details

### getResourceAsStream

InputStream getResourceAsStream(ResourceManager caller) throws ResourceLoadingException

Throws:
  `ResourceLoadingException`

### getResource

byte[] getResource(ResourceManager caller) throws ResourceLoadingException
This is dangerous, especially if the resource is large.

Parameters:
  `caller` -
Returns:
Throws:
  `ResourceLoadingException`

### getResource

int getResource(ResourceManager caller, byte[] target, long offset, int length) throws ResourceLoadingException
Tries to read data into the given byte-array.

Parameters:
  `caller` -
  `target` -
  `offset` -
  `length` -
Returns:
  the number of bytes read or -1 if no more data can be read.
Throws:
  `ResourceLoadingException`

### getLength

long getLength()

### getAttribute

Object getAttribute(String key)

### getKey

ResourceKey getKey()

### getVersion

long getVersion(ResourceManager caller) throws ResourceLoadingException

Throws:
  `ResourceLoadingException`