public class EscapingByteAccumulator extends ByteAccumulator
EscapingByteAccumulator A wraps some ByteAccumulator B where a single escaped
symbol is replaced by two of those symbols when writing to the accumulator.
This allows recursive calls for lists, i.e. one would use the following template:
for (Object i : list) {
i.appendAccumulator(new EscapingByteAccumulator(acc));
acc.appendSeparator();
}
This ensures that the only unescaped separator bytes in acc are the ones
separating list items (all other separator bytes written by the items i are
escaped).| Modifier and Type | Field and Description |
|---|---|
protected ByteAccumulator |
acc |
protected byte |
escapedSymbol |
SEPARATOR| Constructor and Description |
|---|
EscapingByteAccumulator(ByteAccumulator acc)
Sets up an escaping byte accumulator that escapes the separator symbol
|
EscapingByteAccumulator(ByteAccumulator acc,
byte escapedSymbol)
Sets up an escaping byte accumulator that escapes the given symbol
|
| Modifier and Type | Method and Description |
|---|---|
void |
append(byte[] bytes)
Appends bytes to the input x of this accumulator.
|
byte[] |
extractBytes()
Extracts f(x) from the accumulator, where x was input by
append() calls. |
append, append, append, append, appendAndSeparate, appendAndSeparate, appendPadded, appendSeperator, compareTo, escapeAndAppend, escapeAndAppend, escapeAndAppend, escapeAndSeparate, escapeAndSeparate, escapeAndSeparateprotected ByteAccumulator acc
protected byte escapedSymbol
public EscapingByteAccumulator(ByteAccumulator acc)
public EscapingByteAccumulator(ByteAccumulator acc, byte escapedSymbol)
public void append(byte[] bytes)
ByteAccumulatorappend in class ByteAccumulatorpublic byte[] extractBytes()
ByteAccumulatorappend() calls.extractBytes in class ByteAccumulator