• Public
  • Public/Protected
  • All

Class Codec<TFeature>

Encodes Feature instances to an arbitrary format and decodes that arbitrary format to LuciadRIA Feature instances.

A Codec is typically used by a Store to decode the server response and to encode the LuciadRIA Features so they can be sent back to the server. Consult the class documentation of the Store class for more information.

Note: most of the methods in the API are optional. The presence of such an optional method indicates support for that feature. For instance a Store which is read-only only needs a Codec which provides a decode method but does not need an encode method. It is up to the Store implementations to clearly document which methods they require to be present on the Codec.

Users of this class should always check whether such an optional method is available before calling the method, as illustrated below:

  Codec codec = ...;
  if ( typeof codec.encode === "function" ){
    //encode method is available and can be called
    codec.encode( ... );

Type parameters

  • TFeature: Feature

    Represents the type of Feature instances that are handled by the codec.





Abstract decode

  • Decodes the server response from an arbitrary format to a Cursor of Feature instances. Note that by returning a Cursor it is possible to perform lazy decoding (only decoding the Feature when it is requested).


    Returns Cursor<TFeature> | Promise<Cursor<TFeature>>

    A Cursor of Features corresponding to the server response. All Features should be defined in the same reference.

Abstract encode

  • (featureCursor: Cursor<TFeature>): { content: string; contentType: string }
  • Encodes a Cursor of Feature instances into an arbitrary representation, specific to this Codec. This is an optional method.


    • featureCursor: Cursor<TFeature>

      a Cursor of LuciadRIA Features which must be encoded to the arbitrary representation

    Returns { content: string; contentType: string }

    The encoded version of the features

    • content: string

      The encoded content as a string

    • contentType: string

      The mime type describing how the content was encoded as a string


  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method