import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;

import org.apache.struts.actions.DownloadAction.StreamInfo;

/**
 * Implementacion completa de la interfaz StreamInfo, para la descarga de bytes desde el servidor
 * @author dlatorre
 *	
 */
public class ByteStreamInfo implements StreamInfo{
	private String contentType;
	private byte[] data;
	public ByteStreamInfo(String contentType,byte[] data){
		this.contentType=contentType;
		this.data=data;
	}
	/**
	 *  Retorna el content type del stream a descargar
	 */
	public String getContentType() {
		return contentType;
	}
	/**
	 * Retorna un input stream del array de bytes a descargar
	 */
	public InputStream getInputStream() throws IOException {
		InputStream inpt=new ByteArrayInputStream(data); 
		return inpt;
	}
}
