All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jboss.shrinkwrap.api.asset.EmptyAsset Maven / Gradle / Ivy

There is a newer version: 2.0.0-beta-2
Show newest version
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";
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy