org.jnetpcap.util
Class ExpandableString
java.lang.Object
org.jnetpcap.util.JStringBuilder
org.jnetpcap.util.ExpandableString
- All Implemented Interfaces:
- java.lang.Appendable
- Direct Known Subclasses:
- ConfigString
public class ExpandableString
- extends JStringBuilder
A special string that allows easy expandibility within it. The
ExpandableString is made up of 2 parts. A template string and a work buffer.
Whenever a reset() call is made, the buffer is replaced with the contents of
the template. The various replace calls, change the buffer by replacing
certain parts, recursively. Subclasses perform specific expand operations,
that are suited for their needs. Substitutions between single quotes are
omitted and returned untouched. Everything else that is not single quoted,
can be expanded. Escape character, the back-slash, is treated with a lot of
respect.
For example ConfigString subclass replaces variables and properties (marked
with $ and @ signs respectively) with contents from various maps and
properties.
- Author:
- Mark Bednarczyk, Sly Technologies, Inc.
|
Field Summary |
protected int |
count
|
protected int |
end
|
protected int |
start
|
| Methods inherited from class org.jnetpcap.util.JStringBuilder |
append, append, append, append, append, append, append, append, append, append, append, append, append, appendCodePoint, capacity, charAt, codePointAt, codePointBefore, codePointCount, delete, deleteCharAt, ensureCapacity, equals, getChars, hashCode, indexOf, indexOf, insert, insert, insert, insert, insert, insert, insert, insert, insert, insert, insert, insert, lastIndexOf, lastIndexOf, length, offsetByCodePoints, replace, reverse, setCharAt, setLength, subSequence, substring, substring, trimToSize |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
count
protected int count
end
protected int end
start
protected int start
ExpandableString
public ExpandableString(java.lang.String template)
getTemplate
public final java.lang.String getTemplate()
- Returns:
- the template
remove
public boolean remove(java.lang.String seq)
replaceSequence
public boolean replaceSequence(java.lang.String open,
java.lang.String close,
java.lang.String with)
reset
public ExpandableString reset()
restoreQuotes
protected boolean restoreQuotes()
saveQuotes
protected boolean saveQuotes()
scanNext
protected boolean scanNext(java.lang.String open,
java.lang.String close)
scanNext
protected boolean scanNext(java.lang.String open,
java.lang.String close,
int offset)
setTemplate
public final void setTemplate(java.lang.String template)
- Parameters:
template - the template to set
template
public java.lang.String template()
- Returns:
toString
public java.lang.String toString()
- Overrides:
toString in class JStringBuilder
- See Also:
StringBuilder.toString()