org.jboss.shrinkwrap.api.asset.EmptyAsset Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of shrinkwrap-api Show documentation
Show all versions of shrinkwrap-api Show documentation
Client View of the ShrinkWrap Project
package org.jboss.shrinkwrap.api.asset;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
/**
* Implementation of a {@link Asset} having empty content.
*
* @author Dan Allen
* @version $Revision: $
*/
public enum EmptyAsset implements Asset {
INSTANCE;
/**
* Empty contents
*/
final byte[] content = new byte[0];
// -------------------------------------------------------------------------------------||
// Required Implementations -----------------------------------------------------------||
// -------------------------------------------------------------------------------------||
/**
* @see org.jboss.shrinkwrap.api.asset.Asset#openStream()
*/
@Override
public InputStream openStream() {
return new ByteArrayInputStream(content);
}
/**
* Returns the underlying content.
*
*/
public byte[] getSource() {
return content;
}
/**
* {@inheritDoc}
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return "EmptyAsset";
}
}