Logo Search packages:      
Sourcecode: libloader version File versions  Download package

synchronized int org::jfree::resourceloader::cache::CachingResourceData::getResource ( ResourceManager  caller,
byte[]  target,
int  offset,
int  length 
) throws ResourceLoadingException [inline]

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.
Exceptions:
ResourceLoadingException 

Implements org::jfree::resourceloader::ResourceData.

Definition at line 84 of file CachingResourceData.java.

References org::jfree::resourceloader::ResourceData::getResource().

  {
    if (target == null)
    {
      throw new NullPointerException();
    }
    if (target.length < (offset + length))
    {
      throw new IndexOutOfBoundsException();
    }

    if (rawData == null)
    {
      rawData = data.getResource(caller);
    }

    final int maxLength = Math.min (rawData.length - offset, length);
    if (maxLength <= 0)
    {
      return -1;
    }

    System.arraycopy(rawData, offset, target, 0, maxLength);
    return maxLength;
  }


Generated by  Doxygen 1.6.0   Back to index