org.spicefactory.lib.resource
Class ByteArrayResource

java.lang.Object
  extended by org.spicefactory.lib.resource.AbstractResource
      extended by org.spicefactory.lib.resource.ByteArrayResource
All Implemented Interfaces:
Resource

public class ByteArrayResource
extends AbstractResource

Resource implementation that wraps a byte array.

Author:
Jens Halm

Constructor Summary
ByteArrayResource(byte[] buffer)
          Creates a new resource instance wrapping the specified byte array.
ByteArrayResource(byte[] buffer, String path)
          Creates a new resource instance wrapping the specified byte array.
 
Method Summary
 InputStream getInputStream()
          Creates an InputStream for this Resource.
 
Methods inherited from class org.spicefactory.lib.resource.AbstractResource
getPath
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ByteArrayResource

public ByteArrayResource(byte[] buffer)
Creates a new resource instance wrapping the specified byte array.

Parameters:
buffer - the bytes to wrap

ByteArrayResource

public ByteArrayResource(byte[] buffer,
                         String path)
Creates a new resource instance wrapping the specified byte array.

Parameters:
buffer - the bytes to wrap
path - the path of the resource (in the context of this class only a description)
Method Detail

getInputStream

public InputStream getInputStream()
                           throws ResourceException
Description copied from interface: Resource
Creates an InputStream for this Resource.

Returns:
an InputStream for this Resource
Throws:
ResourceException - if the InputStream cannot be created