Class AbstractOnDemandInputStream<T extends OutputStream>
java.lang.Object
java.io.InputStream
org.jboss.shrinkwrap.impl.base.exporter.AbstractOnDemandInputStream<T>
- All Implemented Interfaces:
Closeable, AutoCloseable
Base for on-demand input streams. Encodes data on the fly, when read method is executed.
- Author:
- Michal Matloka
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAbstractOnDemandInputStream(Archive<?> archive) Creates stream directly from archive. -
Method Summary
Modifier and TypeMethodDescriptionprotected 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 InputStream
available, close, mark, markSupported, nullInputStream, read, read, readAllBytes, readNBytes, readNBytes, reset, skip, transferTo
-
Field Details
-
outputStream
Created by abstract method.
-
-
Constructor Details
-
AbstractOnDemandInputStream
Creates stream directly from archive.- Parameters:
archive- The archive from which the stream is created
-
-
Method Details
-
read
- Specified by:
readin classInputStream- Throws:
IOException
-
createOutputStream
Creates the realOutputStreamto which we'll write, wrapping the provided target.- Parameters:
outputStream- The underlying output stream to be wrapped- Returns:
- The created output stream
- 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- The output stream to write tocontext- The context or path of the entryasset- The asset to be written- Throws:
IOException- If an error occurred writing the entry
-
closeEntry
Closes the current entry context for the specifiedOutputStream.- Parameters:
outputStream- The output stream to close the entry for- Throws:
IOException
-