TibrvMsg.setHandlers()

Method

Declaration

static void setHandlers(
    short              userType,
    TibrvMsgEncoder    encoder,
    TibrvMsgDecoder    decoder)

Purpose

Define a custom datatype by registering its encoder and decoder interfaces.

Remarks

The encoder and decoder must implement inverse operators. That is, when the encoder encodes a Java object as a byte array, and the decoder must decode the byte array to an identical Java object. Conversely, when the decoder decodes the byte array to a Java object, the encoder must encode the Java object as an identical byte array.

This method sets (or replaces) both interfaces. Supplying null for either the encoder or the decoder, removes that interface. Supplying null for both interfaces disables the custom type (by removing both interfaces).

Parameter

Description

userType

Define a custom datatype with this numeric designator.

This type designator must be in the inclusive range [TibrvMsg.USER_FIRST,TibrvMsg.USER_LAST].

encoder

Register this encoder for the type.

decoder

Register this decoder for the type.

See Also

TibrvMsgDecoder

TibrvMsgEncoder