Package com.lucimber.dbus.codec.encoder
Class DictEncoder<KeyT extends DBusBasicType,ValueT extends DBusType>
java.lang.Object
com.lucimber.dbus.codec.encoder.DictEncoder<KeyT,ValueT>
- Type Parameters:
KeyT
- The data type of the key.ValueT
- The data type of the value.
- All Implemented Interfaces:
Encoder<DBusDict<KeyT,
ValueT>, ByteBuffer>
public final class DictEncoder<KeyT extends DBusBasicType,ValueT extends DBusType>
extends Object
implements Encoder<DBusDict<KeyT,ValueT>,ByteBuffer>
An encoder which encodes a dictionary to the D-Bus marshalling format using ByteBuffer.
-
Constructor Summary
ConstructorsConstructorDescriptionDictEncoder
(ByteOrder order, DBusSignature signature) Constructs a new instance. -
Method Summary
Modifier and TypeMethodDescriptionEncodes a value into bytes.
-
Constructor Details
-
DictEncoder
Constructs a new instance.- Parameters:
order
- The byte order of the produced bytes.signature
- The full signature of the dictionary.
-
-
Method Details
-
encode
public EncoderResult<ByteBuffer> encode(DBusDict<KeyT, ValueT> dict, int offset) throws EncoderExceptionDescription copied from interface:Encoder
Encodes a value into bytes.- Specified by:
encode
in interfaceEncoder<KeyT extends DBusBasicType,
ValueT extends DBusType> - Parameters:
dict
- The data type that needs to be encoded.offset
- The byte count of already encoded bytes, which is necessary for alignment padding.- Returns:
- An
EncoderResult
containing the marshalled representation of the value. - Throws:
EncoderException
- If the value could not have been encoded.
-