Preon encode() does not fill up remaining bits until the byte boundary is reached

156 views Asked by At

I have a message where a variable length of 7Bit characters is encoded. Unfortunately those 7Bit characters are stored in the message as 7Bit. That means the last byte of the message is not necessarily aligned to a byte boundary.

Decoding a message with Preon works fine, but when encoding the previously decoded message with Preon and comparing the byte arrays, the arrays do not match in length. The encoded byte array is one byte smaller than the original one.

I debugged Preon because I assumed a bug, but it works as designed. When a byte boundary is reached, Preon stores the remaining bits until the next write() call to the BitChannel occures. But for the last byte there is no further call.

The question is, is there a way to tell Preon to flush the remaining buffer?

0

There are 0 answers