Class SequenceEncoder

java.lang.Object
VASSAL.tools.SequenceEncoder

public class SequenceEncoder extends 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();