Package org.jboss.shrinkwrap.api.asset
Class ByteArrayAsset
- java.lang.Object
-
- org.jboss.shrinkwrap.api.asset.ByteArrayAsset
-
-
Constructor Summary
Constructors Constructor Description ByteArrayAsset(byte[] content)Creates a newAssetinstance backed by the specified byte arrayByteArrayAsset(InputStream stream)Creates a newAssetinstance backed by the bytes contained in the the specifiedInputStream
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]getSource()Returns the underlying content.InputStreamopenStream()Get a input stream for the resource content.StringtoString()
-
-
-
Constructor Detail
-
ByteArrayAsset
public ByteArrayAsset(byte[] content) throws IllegalArgumentExceptionCreates a newAssetinstance backed by the specified byte array- Parameters:
content-- Throws:
IllegalArgumentException- If the contents were not specified
-
ByteArrayAsset
public ByteArrayAsset(InputStream stream)
Creates a newAssetinstance backed by the bytes contained in the the specifiedInputStream- Parameters:
stream-- Throws:
IllegalArgumentException- If the stream is not specified
-
-
Method Detail
-
openStream
public InputStream openStream()
Description copied from interface:AssetGet a input stream for the resource content. The caller is responsible for closing the stream.- Specified by:
openStreamin interfaceAsset- Returns:
- A new open
InputStreamfor each call - See Also:
Asset.openStream()
-
getSource
public byte[] getSource()
Returns the underlying content.
-
toString
public String toString()
- Overrides:
toStringin classObject- See Also:
Object.toString()
-
-