public abstract class TextInspectorEngine extends NodeEngine implements NutFilterHolder, EngineRequestTransformer.RequireEngineRequestTransformer
Basic inspector engine for text nuts processing text line per line. This kind of engine inspects
each nut of a request to eventually alter their content or to extract other referenced nuts
thanks to a set of inspectors.
| Constructor and Description |
|---|
TextInspectorEngine(Boolean inspect,
String cs,
LineInspector... inspectors)
Builds a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addInspector(LineInspector inspector)
Adds a new inspector.
|
protected void |
inspect(ConvertibleNut nut,
EngineRequest request)
Extracts from the given nut all the nuts referenced by the @import statement in CSS.
|
protected String |
inspectLine(String line,
EngineRequest request,
LineInspector inspector,
List<LineInspector.ReplacementInfo> replacementInfoList,
CompositeNut.CompositeInputStream cis,
ConvertibleNut original)
Inspects the given line and eventually adds some extracted nuts to the nut referencing it.
|
List<ConvertibleNut> |
internalParse(EngineRequest request)
Internal method that parses eventually called by
NodeEngine.parse(EngineRequest) method during its invocation. |
void |
setNutFilter(List<NutFilter> nutFilters)
Sets the filter.
|
void |
transform(InputStream is,
OutputStream os,
ConvertibleNut convertibleNut,
EngineRequest request)
Matches the
Pipe.Transformer.transform(java.io.InputStream, java.io.OutputStream, Object)
signature with an additional EngineRequest. |
Boolean |
works()
Returns a flag indicating if the engine is configured to do something or not.
|
callNextEngine, chain, getNext, getNutTypes, getPrevious, parse, setNextcompareTo, getEngineTypepublic TextInspectorEngine(Boolean inspect, String cs, LineInspector... inspectors)
Builds a new instance.
inspect - activate inspection or notcs - files charsetinspectors - the line inspectors to usepublic final void addInspector(LineInspector inspector)
Adds a new inspector.
inspector - the new inspectorpublic List<ConvertibleNut> internalParse(EngineRequest request) throws WuicException
Internal method that parses eventually called by NodeEngine.parse(EngineRequest) method during its invocation.
internalParse in class Enginerequest - the request with files to parseWuicException - if any kind of error occursprotected void inspect(ConvertibleNut nut, EngineRequest request) throws WuicException
Extracts from the given nut all the nuts referenced by the @import statement in CSS.
nut - the nutrequest - the initial requestWuicException - if an I/O error occurs while readingprotected String inspectLine(String line, EngineRequest request, LineInspector inspector, List<LineInspector.ReplacementInfo> replacementInfoList, CompositeNut.CompositeInputStream cis, ConvertibleNut original) throws WuicException
Inspects the given line and eventually adds some extracted nuts to the nut referencing it.
This method is recursive.
line - the line to be inspectedrequest - the initial requestinspector - the inspector to usereplacementInfoList - the collection where any referenced nut identified by the method will be addedcis - a composite stream which indicates what nut owns the transformed text, null if the nut is not a compositionoriginal - the inspected nutWuicException - if an I/O error occurs while readingpublic Boolean works()
Returns a flag indicating if the engine is configured to do something or not.
public void setNutFilter(List<NutFilter> nutFilters)
Sets the filter.
setNutFilter in interface NutFilterHoldernutFilters - the filterspublic void transform(InputStream is, OutputStream os, ConvertibleNut convertibleNut, EngineRequest request) throws IOException
Matches the Pipe.Transformer.transform(java.io.InputStream, java.io.OutputStream, Object)
signature with an additional EngineRequest.
transform in interface EngineRequestTransformer.RequireEngineRequestTransformeris - the inputos - the outputconvertibleNut - the object that provides the original input streamrequest - the EngineRequestIOException - if an I/O error occursCopyright © 2012-2015. All Rights Reserved.