Hi,

You want to use capnp::FlatArrayMessageReader as defined in
capnp/serialize.h .

Note that it wants an array of capnp::word, not bytes. You can use
reinterpret_cast, but note that the buffer needs to be 64-bit aligned (or
32-bit aligned on 32-bit systems). This is usually easy to guarantee but
it's up to you.

    capnp::FlatArrayMessageReader reader(kj::arrayPtr(
        reinterpret_cast<const capnp::word*>(myBytes), myBytes /
sizeof(capnp::word)));

-Kenton

On Wed, Apr 5, 2017 at 3:16 AM, <[email protected]> wrote:

> Hello,
>
> I'm trying to deserialise from a byte array in memory in every possible
> way but nothing seems to work. I have the data in memory and want to both
> check it for  correctness and deserialise it. What is the cannonical way to
> do this?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Cap'n Proto" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> Visit this group at https://groups.google.com/group/capnproto.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Cap'n Proto" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at https://groups.google.com/group/capnproto.

Reply via email to