Package com.lucimber.dbus.codec.encoder
Class DictEntryEncoder<KeyT extends DBusBasicType,ValueT extends DBusType>
java.lang.Object
com.lucimber.dbus.codec.encoder.DictEntryEncoder<KeyT,ValueT>
- Type Parameters:
KeyT
- The data type of the key.ValueT
- The data type of the value.
- All Implemented Interfaces:
Encoder<DBusDictEntry<KeyT,
ValueT>, ByteBuffer>
public final class DictEntryEncoder<KeyT extends DBusBasicType,ValueT extends DBusType>
extends Object
implements Encoder<DBusDictEntry<KeyT,ValueT>,ByteBuffer>
An encoder which encodes a key-value pair to the D-Bus marshalling format using ByteBuffer.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionDictEntryEncoder
(ByteOrder order, DBusSignature signature) Constructs a new instance with mandatory parameters. -
Method Summary
Modifier and TypeMethodDescriptionencode
(DBusDictEntry<KeyT, ValueT> entry, int offset) Encodes a value into bytes.
-
Constructor Details
-
DictEntryEncoder
Constructs a new instance with mandatory parameters.- Parameters:
order
- The byte order of the produced bytes.signature
- The signature of the dictionary entry.
-
-
Method Details
-
encode
public EncoderResult<ByteBuffer> encode(DBusDictEntry<KeyT, ValueT> entry, 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:
entry
- 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.
-