Package com.lucimber.dbus.codec.encoder
Class StructEncoder
java.lang.Object
com.lucimber.dbus.codec.encoder.StructEncoder
- All Implemented Interfaces:
Encoder<DBusStruct,ByteBuffer>
An encoder which encodes a struct to the D-Bus marshalling format using ByteBuffer.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionStructEncoder(ByteOrder order, DBusSignature signature) Constructs a new instance with mandatory parameter. -
Method Summary
Modifier and TypeMethodDescriptionencode(DBusStruct struct, int offset) Encodes a value into bytes.
-
Constructor Details
-
StructEncoder
Constructs a new instance with mandatory parameter.- Parameters:
order- the byte order of the produced bytessignature- the signature of the struct being encoded
-
-
Method Details
-
encode
Description copied from interface:EncoderEncodes a value into bytes.- Specified by:
encodein interfaceEncoder<DBusStruct,ByteBuffer> - Parameters:
struct- The data type that needs to be encoded.offset- The byte count of already encoded bytes, which is necessary for alignment padding.- Returns:
- An
EncoderResultcontaining the marshalled representation of the value. - Throws:
EncoderException- If the value could not have been encoded.
-