org.jboss.shrinkwrap.api.asset
Class ArchiveAsset

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

public class ArchiveAsset
extends Object
implements Asset

An Asset representing an Archive; a specified StreamExporter type will be used to fulfill the Asset.openStream() contract.

Version:
$Revision: $
Author:
John Bailey, ALR

Constructor Summary
ArchiveAsset(Archive<?> archive, Class<? extends StreamExporter> exporter)
          Creates a new instance wrapping the specified Archive, which will use the specified StreamExporter to represent the archive as an InputStream in Asset.openStream().
 
Method Summary
 Archive<?> getArchive()
          Returns the archive this asset represents
 InputStream openStream()
          Get a input stream for the resource content.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArchiveAsset

public ArchiveAsset(Archive<?> archive,
                    Class<? extends StreamExporter> exporter)
Creates a new instance wrapping the specified Archive, which will use the specified StreamExporter to represent the archive as an InputStream in Asset.openStream().

Parameters:
archive -
exporter -
Throws:
IllegalArgumentException - If either argument is not specified
Method Detail

openStream

public InputStream openStream()
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()

getArchive

public Archive<?> getArchive()
Returns the archive this asset represents

Returns:


Copyright © 2012 JBoss by Red Hat. All Rights Reserved.