Skip to content
sijuv edited this page Aug 20, 2011 · 3 revisions

There are certain Features that could be passed in to the codec. These features are defined as enum in Codec.Feature.

These features can be set to the codec using the Codec.setFeature method. An attempt to set a feature not supported on a particular type of codec or an attempt to set a value which is not correct for the feature will cause an IllegalArgumentException with the appropriate message.

The features are listed below :

  • PRETTY_PRINT : Whether to pretty print the output (json/xml) : Only supported for JSON codec. Set to FALSE by default for JsonCodec

  • CLOSE_STREAM : Whether to close the InputStream when reading in the message automatically once the message is read in, or to automatically close the OutputStream once the whole message is written out. This feature is set to TRUE by default for all Codec.

  • SUPPORT_UNKNOWN_FIELDS : Whether to support unknown fields. Handling-of-Unknown-Fields . Set to TRUE by default for all codecs.

  • UNKNOWN_FIELD_ELEM_NAME : The field name for unknown fields. Handling-of-Unknown-Fields

  • EXTENSION_FIELD_NAME_PREFIX : The prefix to be used for extension fields Handling-of-Extension-Fields

  • STRIP_FIELD_NAME_UNDERSCORES : Strip leading and trailing underscores from the fields, esp useful when integrating with other frameworks, currently limited to json.

  • FIELD_NAME_READ_SUBSTITUTES : Read field name substitue, useful when mapping one struct to another.

  • FIELD_NAME_WRITE_SUBSTITUTES : Substitute field names while writing, useful when mapping one struct to another

Clone this wiki locally