VASSAL.tools
Class SequenceEncoder
java.lang.Object
|
+--VASSAL.tools.SequenceEncoder
- public class SequenceEncoder
- extends java.lang.Object
Encodes a sequence of Strings into a single String with a given delimiter.
Escapes the delimiter character if it occurs in the element strings.
This is a very handy class for storing structured data into flat text and quite a bit faster than parsing
an XML document.
For example, a structure such as {A,{B,C}} can be encoded with
new SequenceEncoder("A",',').append(new SequenceEncoder("B",',').append("C").getValue()).getValue()
which returns A,B\,C
and then extracted with
SequenceEncoder.Decoder st = new SequenceEncoder.Decoder("A,B\,C",',');
String A = st.nextToken();
SequenceEncoder.Decoder BC = new SequenceEncoder.Decoder(st.nextToken(),',');
String B = BC.nextToken();
String C = BC.nextToken();
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SequenceEncoder
public SequenceEncoder(char delimiter)
SequenceEncoder
public SequenceEncoder(java.lang.String val,
char delimiter)
append
public SequenceEncoder append(java.lang.String s)
getValue
public java.lang.String getValue()
main
public static void main(java.lang.String[] args)