public class CompositeNut extends PipedConvertibleNut
 A composite Nut is able to chain all the stream provided by each element of the composition. We consider that
 all the nuts of the composition should have the same state (name, etc).
 
| Modifier and Type | Class and Description | 
|---|---|
static class  | 
CompositeNut.Combiner
 This class combines different sets of nuts as specified by  
mergeNuts(ProcessContext, List)
 It ensures that every names will be unique in returned lists during the entire lifecycle of its instance. | 
class  | 
CompositeNut.CompositeInputStream
 This class keeps the position of each nut in the read content. 
 | 
| Constructor and Description | 
|---|
CompositeNut(Boolean avn,
            String specificName,
            byte[] separator,
            ProcessContext processContext,
            ConvertibleNut... composition)
 Builds a new instance. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
Boolean | 
getAsynchronousVersionNumber()
 Indicates if version number is computed asynchronously. 
 | 
boolean | 
isDynamic()
 Indicates if this nut has a dynamic content, meaning that it could be changed each time  
Nut.openStream() is
 invoked. | 
static List<ConvertibleNut> | 
mergeNuts(ProcessContext processContext,
         List<ConvertibleNut> nuts)
 Merges all sequences  
nuts with the same name into one CompositeNut. | 
InputStream | 
openStream()
 Opens and returns an  
InputStream pointing to the nut. | 
void | 
transform(Pipe.OnReady... onReady)
 Transforms the source stream with all registered transformers and calls the given callback in addition
 to callbacks previously registered. 
 | 
isTransformed, setTransformed, transformaddReferencedNut, addTransformer, equals, getName, getNutType, getOriginalNuts, getParentFile, getReadyCallbacks, getReferencedNuts, getTransformers, hashCode, isCompressed, isSubResource, onReady, setIsCompressed, setIsSubResource, setNutName, setNutType, setOriginalNutsgetInitialName, getInitialNutType, getProxyUri, getVersionNumber, setProxyUri, setVersionNumber, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetInitialName, getInitialNutType, getProxyUri, getVersionNumber, setProxyUripublic CompositeNut(Boolean avn, String specificName, byte[] separator, ProcessContext processContext, ConvertibleNut... composition)
Builds a new instance.
avn - indicates if version computation is done asynchronously or notcomposition - the nuts of this compositionseparator - the bytes between each stream, null if nothingspecificName - the name of the compositionprocessContext - the process contextpublic Boolean getAsynchronousVersionNumber()
Indicates if version number is computed asynchronously.
true if asynchronous operation is performed, false otherwisepublic boolean isDynamic()
 Indicates if this nut has a dynamic content, meaning that it could be changed each time Nut.openStream() is
 invoked. In this case the nut should not be added to any cache and transformation chain should be applied.
 
isDynamic in interface NutisDynamic in class AbstractConvertibleNuttrue if content is dynamic, false otherwisepublic void transform(Pipe.OnReady... onReady) throws IOException
Transforms the source stream with all registered transformers and calls the given callback in addition to callbacks previously registered. The method also writes the result to the given output stream.
transform in interface ConvertibleNuttransform in class PipedConvertibleNutonReady - the callbackIOException - if an I/O error occurspublic InputStream openStream() throws IOException
 Opens and returns an InputStream pointing to the nut.
 
openStream in interface NutopenStream in class AbstractConvertibleNutIOException - if an I/O error occurspublic static List<ConvertibleNut> mergeNuts(ProcessContext processContext, List<ConvertibleNut> nuts)
 Merges all sequences nuts with the same name into one CompositeNut. When a stream is read
 in a composite object, a composite InputStream is returned and will read each stream in the order of the
 list. When a composition is created, its name is prefixed with the its position in the given list.
 
For instance, ['foo.js', 'foo.js', 'bar.css', 'baz.js', 'foo.js'] => ['0foo.js', 'bar.css', 'baz.js', 'foo.js'] where the first element is a composition and where "prefixCountStart" equals to 0.
processContext - the process contextnuts - the nuts to mergeCopyright © 2012-2015. All Rights Reserved.