|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.neu.ccs.codec.EscapedCodec
implementation
whose encoding scheme uses separator sequences
to separate distinct data elements
and uses escape sequences to mask separator sequences
and escape sequences at each level of recursion.
This CODEC does not make use of data compression,
and does not result in any data loss.
This CODEC produces encoded data
that is extremely readable at low levels of recursion,
but is very difficult to read at high levels
of recursion.CODEC
The unique three letter identifier
for this CODEC is "ESC".
This CODEC is automatically installed by the JPT.
CodecUtilities,
Serialized Form| Field Summary | |
private static String |
ESCAPE
The sequence of characters that escapes the following character or sequence from being considered an escape or separator sequence. |
private static String |
NULL
The sequence of characters that represents null,
or "no data". |
private static String |
SEPARATOR
The sequence of characters that separates elements of an encoded String. |
| Constructor Summary | |
EscapedCodec()
Constructs an object capable of encoding and decoding data using the "Escaped-separated" encoding scheme. |
|
| Method Summary | |
String[] |
decode(String data)
Decodes the given compound data String
into an array of data Strings
using the "Escaped-separated" encoding scheme. |
String |
encode(String[] data)
Encodes the given array of data Strings
into a single compound data String
using the "Escaped-separated" encoding scheme. |
private String |
escape(String data)
Prepares an individual element from the array of String data
for encoding by preceding each separator
and escape sequence with an escape sequence. |
String |
getPrefix()
Returns the unique identifier for this encoding scheme: the String "ESC". |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private static final String SEPARATOR
String.
private static final String ESCAPE
private static final String NULL
null,
or "no data".
| Constructor Detail |
public EscapedCodec()
| Method Detail |
public String encode(String[] data)
Strings
into a single compound data String
using the "Escaped-separated" encoding scheme.
If the given array is null,
a representation of null is returned.
encode in interface Codecdata - an array of data Strings
Stringdecode(String),
CodecUtilities.encode(String[]),
CodecUtilities.encode(Stringable[]),
Codec
public String[] decode(String data)
throws ParseException
String
into an array of data Strings
using the "Escaped-separated" encoding scheme.
If the given data is null
or the representation of null,
this method returns null.
decode in interface Codecdata - an encoded data String
Strings
ParseException - if the data was not encoded
using this schemeencode(String[]),
CodecUtilities.decode(String),
Codecpublic String getPrefix()
String "ESC".
getPrefix in interface CodecCodecUtilities.installCodec(Codec),
CodecUtilities.getDefaultCodec(),
Codecprivate String escape(String data)
String data
for encoding by preceding each separator
and escape sequence with an escape sequence.
If the given data is null,
the representation for null data is returned.
data - the data String to escape
Stringencode(String[])
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||