org.jboss.shrinkwrap.api.asset
Class ByteArrayAsset

java.lang.Object
  extended by org.jboss.shrinkwrap.api.asset.ByteArrayAsset
All Implemented Interfaces:
Asset

public class ByteArrayAsset
extends Object
implements Asset

Implementation of an Asset backed by a byte array

Version:
$Revision: $
Author:
ALR

Constructor Summary
ByteArrayAsset(byte[] content)
          Creates a new Asset instance backed by the specified byte array
ByteArrayAsset(InputStream stream)
          Creates a new Asset instance backed by the bytes contained in the the specified InputStream
 
Method Summary
 InputStream openStream()
          Get a input stream for the resource content.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ByteArrayAsset

public ByteArrayAsset(byte[] content)
               throws IllegalArgumentException
Creates a new Asset instance backed by the specified byte array

Parameters:
content -
Throws:
IllegalArgumentException - If the contents were not specified

ByteArrayAsset

public ByteArrayAsset(InputStream stream)
Creates a new Asset instance backed by the bytes contained in the the specified InputStream

Parameters:
stream -
Throws:
IllegalArgumentException - If the stream is not specified
Method Detail

openStream

public InputStream openStream()
Description copied from interface: Asset
Get a input stream for the resource content. The caller is responsible for closing the stream. If this returns null, this denotes that the Asset is to be viewed as a logical path (placeholder/directory) only with no backing content.

Specified by:
openStream in interface Asset
Returns:
A new open InputStream for each call, or null if this type simply represents a logical path within an Archive
See Also:
Asset.openStream()

toString

public String toString()

Overrides:
toString in class Object
See Also:
Object.toString()


Copyright © 2011 JBoss, a division of Red Hat, Inc.. All Rights Reserved.