Class AbstractOnDemandInputStream<T extends OutputStream>
- java.lang.Object
-
- java.io.InputStream
-
- org.jboss.shrinkwrap.impl.base.exporter.AbstractOnDemandInputStream<T>
-
- All Implemented Interfaces:
Closeable,AutoCloseable
public abstract class AbstractOnDemandInputStream<T extends OutputStream> extends InputStream
Base for on-demand input streams. Encodes data on the fly, when read method is executed.- Author:
- Michal Matloka
-
-
Field Summary
Fields Modifier and Type Field Description protected ToutputStreamCreated by abstract method.
-
Constructor Summary
Constructors Constructor Description AbstractOnDemandInputStream(Archive<?> archive)Creates stream directly from archive.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract voidcloseEntry(T outputStream)Closes the current entry context for the specifiedOutputStream.protected abstract TcreateOutputStream(OutputStream outputStream)Creates the realOutputStreamto which we'll write, wrapping the provided target.protected abstract voidputNextEntry(T outputStream, String context, Asset asset)Writes the next entry (demarcates a new file/folder is to be written).intread()-
Methods inherited from class java.io.InputStream
available, close, mark, markSupported, nullInputStream, read, read, readAllBytes, readNBytes, readNBytes, reset, skip, transferTo
-
-
-
-
Field Detail
-
outputStream
protected T extends OutputStream outputStream
Created by abstract method.
-
-
Constructor Detail
-
AbstractOnDemandInputStream
public AbstractOnDemandInputStream(Archive<?> archive)
Creates stream directly from archive.- Parameters:
archive-
-
-
Method Detail
-
read
public int read() throws IOException- Specified by:
readin classInputStream- Throws:
IOException
-
createOutputStream
protected abstract T createOutputStream(OutputStream outputStream) throws IOException
Creates the realOutputStreamto which we'll write, wrapping the provided target.- Parameters:
outputStream-- Returns:
- Throws:
IOException- If an error occurred in creating the stream
-
putNextEntry
protected abstract void putNextEntry(T outputStream, String context, Asset asset) throws IOException
Writes the next entry (demarcates a new file/folder is to be written).- Parameters:
outputStream-context-- Throws:
IOException- If an error occurred writing the entry
-
closeEntry
protected abstract void closeEntry(T outputStream) throws IOException
Closes the current entry context for the specifiedOutputStream.- Parameters:
outputStream-- Throws:
IOException
-
-