edu.neu.ccs.codec
Class CodecUtilities

java.lang.Object
  |
  +--edu.neu.ccs.codec.CodecUtilities

public class CodecUtilities
extends Object

Contains utility methods providing CODEC operations. Nonstandard CODECs, that is, CODECs that are not included in the JPT, must be installed using the installCodec method of this class. Encoding and decoding operations must be performed through the methods of this class, and not directly through the methods of an instance of any particular CODEC.

See Also:
Codec

Constructor Summary
CodecUtilities()
           
 
Method Summary
static String[] decode(String data)
          Decodes the given encoded data String into its (possibly encoded) component parts, using the CODEC identified within the data by its unique prefix.
static String encode(String[] data)
          Encodes the given array of (possibly encoded) data Strings into a single encoded data String using the default CODEC.
static String encode(String[] data, String codecID)
          Encodes the given array of (possibly encoded) data Strings into a single encoded data String using the installed CODEC with the given unique identifier.
static String encode(Stringable[] data)
          Encodes the given array of Stringable objects into an encoded data String using the default CODEC.
static String encode(Stringable[] data, String codecID)
          Encodes the given array of Stringable objects into a single encoded data String using the installed CODEC with the given unique identifier.
static String getDefaultCodec()
          Returns the unique identifier for the default installed CODEC.
static void installCodec(Codec c)
          Installs the given CODEC in the table of available CODECs.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CodecUtilities

public CodecUtilities()
Method Detail

decode

public static String[] decode(String data)
Decodes the given encoded data String into its (possibly encoded) component parts, using the CODEC identified within the data by its unique prefix.

Parameters:
data - a data String to be decoded
Returns:
the resulting array of Strings
Since:
1.0
See Also:
encode(String[]), encode(String[], String), encode(Stringable[]), encode(Stringable[], String)

encode

public static String encode(String[] data)
Encodes the given array of (possibly encoded) data Strings into a single encoded data String using the default CODEC.

Parameters:
data - an array of data Strings to be encoded
Returns:
the encoded data String
Since:
1.0
See Also:
decode(String), encode(String[], String), encode(Stringable[]), encode(Stringable[], String)

encode

public static String encode(String[] data,
                            String codecID)
Encodes the given array of (possibly encoded) data Strings into a single encoded data String using the installed CODEC with the given unique identifier.

Parameters:
data - an array of data Strings to be encoded
codecID - the unique identifier for the desired CODEC
Returns:
the resulting encoded data String
Since:
1.0
See Also:
decode(String), encode(String[]), encode(Stringable[]), encode(Stringable[], String)

encode

public static String encode(Stringable[] data)
Encodes the given array of Stringable objects into an encoded data String using the default CODEC.

Parameters:
data - an array of objects to be encoded
Returns:
the resulting encoded data String
Since:
1.0
See Also:
decode(String), encode(String[]), encode(String[], String), encode(Stringable[], String)

encode

public static String encode(Stringable[] data,
                            String codecID)
Encodes the given array of Stringable objects into a single encoded data String using the installed CODEC with the given unique identifier.

Parameters:
data - an array of objects to be encoded
codecID - the unique identifier for the desired CODEC
Returns:
the resulting encoded data String
Since:
1.0
See Also:
decode(String), encode(String[]), encode(String[], String), encode(Stringable[])

getDefaultCodec

public static String getDefaultCodec()
Returns the unique identifier for the default installed CODEC.

Since:
1.0
See Also:
encode(String[], String), encode(Stringable[], String)

installCodec

public static void installCodec(Codec c)
Installs the given CODEC in the table of available CODECs.

Parameters:
c - the desired CODEC object to install
Since:
1.0