public abstract class AbstractStringTransformer extends AbstractCharStreamTransformer
Base class to facilitate creating transformers on text content, loading
text into StringBuilder
for memory processing, also giving more
options (like fancy regex). This class check for free memory every 10KB of
text read. If enough memory, it keeps going for another 10KB or until
all the content is read, or the buffer size reaches half the available
memory. In either case, it passes the buffered content so far for
transformation (all of it for small enough content, or in several
chunks for large content).
Implementors should be conscious about memory when dealing with the string builder.
Subclasses implementing IXMLConfigurable
should allow this inner
configuration:
<contentTypeRegex> (regex to identify text content-types, overridding default) </contentTypeRegex> <restrictTo caseSensitive="[false|true]" > property="(name of header/metadata name to match)" (regular expression of value to match) </restrictTo>
Constructor and Description |
---|
AbstractStringTransformer() |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
int |
hashCode() |
String |
toString() |
protected abstract void |
transformStringDocument(String reference,
StringBuilder content,
Properties metadata,
boolean parsed,
boolean partialContent) |
protected void |
transformTextDocument(String reference,
Reader input,
Writer output,
Properties metadata,
boolean parsed) |
transformDocument
documentAccepted, getContentTypeRegex, loadFromXML, saveToXML, setContentTypeRegex
setRestriction
protected final void transformTextDocument(String reference, Reader input, Writer output, Properties metadata, boolean parsed) throws IOException
transformTextDocument
in class AbstractCharStreamTransformer
IOException
protected abstract void transformStringDocument(String reference, StringBuilder content, Properties metadata, boolean parsed, boolean partialContent)
public boolean equals(Object obj)
equals
in class AbstractCharStreamTransformer
public int hashCode()
hashCode
in class AbstractCharStreamTransformer
public String toString()
toString
in class AbstractTextRestrictiveHandler
Copyright © 2009-2014 Norconex Inc.. All Rights Reserved.