org.ccnx.ccn.impl.encoding.TextXMLCodec Class Reference

A text-based XML codec. More...

List of all members.

Static Public Member Functions

static String codecName ()
 The name of this codec.
static String encodeBinaryElement (byte[] element)
 Encodes a binary element as base 64.
static String encodeBinaryElement (byte[] element, int offset, int length)
 Encodes a binary element as base 64.
static byte[] decodeBinaryElement (String element) throws IOException
 Decodes a base64-encoded binary element back into a byte array.
static String formatDateTime (CCNTime dateTime)
 Encapsulate our timestamp formatting/parsing for consistency.
static CCNTime parseDateTime (String strDateTime) throws ParseException
 Encapsulate our timestamp formatting/parsing for consistency.

Static Public Attributes

static final String CCN_NAMESPACE = "http://www.parc.com/ccn"
static final String CCN_PREFIX = "ccn"
static final String CODEC_NAME = "Text"
static final String BINARY_ATTRIBUTE = "ccnbencoding"
static final String BINARY_ATTRIBUTE_VALUE = "base64Binary"

Static Protected Attributes

static DateFormat canonicalWriteDateFormat = null
static DateFormat canonicalReadDateFormat = null
static final String PAD_STRING = "000000000"
static final int NANO_LENGTH = 9

Static Package Functions

 [static initializer]

Detailed Description

A text-based XML codec.

Close to standard text XML, though with limited support for things like namespaces. This class contains utility functions used by TextXMLEncoder and TextXMLDecoder as well as setup to use this codec with XMLCodecFactory.


Member Function Documentation

static String org.ccnx.ccn.impl.encoding.TextXMLCodec.codecName (  )  [static]

The name of this codec.

Used to generate XMLEncoder and XMLDecoder instances with XMLCodecFactory.

Returns:
the codec name.
static byte [] org.ccnx.ccn.impl.encoding.TextXMLCodec.decodeBinaryElement ( String  element  )  throws IOException [static]

Decodes a base64-encoded binary element back into a byte array.

Parameters:
element base64-encoded element content
Returns:
the decoded byte array
Exceptions:
IOException if element is not valid base64
static String org.ccnx.ccn.impl.encoding.TextXMLCodec.encodeBinaryElement ( byte[]  element,
int  offset,
int  length 
) [static]

Encodes a binary element as base 64.

Parameters:
element the element data to encode. Needs to handle null and 0-length elements
offset the offset into element at which to start encoding
length how many bytes of element to encode
Returns:
the binary data base64 encoded into a String
static String org.ccnx.ccn.impl.encoding.TextXMLCodec.encodeBinaryElement ( byte[]  element  )  [static]

Encodes a binary element as base 64.

Parameters:
element the element data to encode. Needs to handle null and 0-length elements
Returns:
the binary data base64 encoded into a String
static String org.ccnx.ccn.impl.encoding.TextXMLCodec.formatDateTime ( CCNTime  dateTime  )  [static]

Encapsulate our timestamp formatting/parsing for consistency.

Use a simple standard format for outputing a quantized CCNTime.

Parameters:
dateTime the timestamp to encode
Returns:
the formatted timestamp
static CCNTime org.ccnx.ccn.impl.encoding.TextXMLCodec.parseDateTime ( String  strDateTime  )  throws ParseException [static]

Encapsulate our timestamp formatting/parsing for consistency.

Use a simple standard format for outputing a quantized CCNTime.

Parameters:
strDateTime the string-encoded timestamp
Returns:
the parsed timestamp as a CCNTime

The documentation for this class was generated from the following file:
Generated on Fri May 13 16:27:38 2011 for Content-Centric Networking in Java by  doxygen 1.6.3