TibrvMsgEncoder.encode()

Method

Declaration

byte[] encode(
    short type,
    java.lang.Object data)

Purpose

Encode a Java object as a wire format custom datatype.

Remarks

Before calling this method, TibrvMsg first checks its applicability by calling TibrvMsgEncoder.canEncode(). Whenever TibrvMsgEncoder.canEncode() indicates that encoding is viable, this method must correctly encode the object.

When this method successfully encodes the data, it must return the encoding as a byte array; the byte array value can have length zero. When this method fails, it must return null.

Methods that call TibrvMsgEncoder.encode() incorporate its byte array value directly into a TibrvMsg object.

Parameter

Description

type

Encode the data as an instance of this custom datatype.

data

Encode this data.

See Also

TibrvMsgDecoder.decode()

TibrvMsgEncoder.canEncode()