Discussion:
[capnproto] how to use the function named writePackedMessage?
max
2018-05-07 12:34:42 UTC
Permalink
I am reading the code,
i can write a message to the file,but how can i serialize the message to
stream?
use writePackedMessage?
i just want to serialize the message ,but dont write the serialized message
to file ?
can you help me ?
--
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 capnproto+***@googlegroups.com.
Visit this group at https://groups.google.com/group/capnproto.
'Kenton Varda' via Cap'n Proto
2018-05-14 22:21:22 UTC
Permalink
Hi Max,

You'll need to write a custom implementation of the kj::OutputStream
interface, then pass it to `writePackedMessage()`. Or, you could use
kj::ArrayOutputSteam or kj::VectorOutputStream, if you just want to write
to an in-memory byte array.

-Kenton
Post by max
I am reading the code,
i can write a message to the file,but how can i serialize the message to
stream?
use writePackedMessage?
i just want to serialize the message ,but dont write the serialized
message to file ?
can you help me ?
--
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
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 capnproto+***@googlegroups.com.
Visit this group at https://groups.google.com/group/capnproto.
max
2018-05-15 01:11:34 UTC
Permalink
Hi Kenton,
thanks a lot. It‘s very helpful.
it has kj::VectorOutputStream,but no kj::VectorInputStream, i dont know
why.it confuses me.
i have to write a custom implementation

圚 2018幎5月15日星期二 UTC+8䞊午6:22:04Kenton Varda写道
Post by 'Kenton Varda' via Cap'n Proto
Hi Max,
You'll need to write a custom implementation of the kj::OutputStream
interface, then pass it to `writePackedMessage()`. Or, you could use
kj::ArrayOutputSteam or kj::VectorOutputStream, if you just want to write
to an in-memory byte array.
-Kenton
Post by max
I am reading the code,
i can write a message to the file,but how can i serialize the message to
stream?
use writePackedMessage?
i just want to serialize the message ,but dont write the serialized
message to file ?
can you help me ?
--
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
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 capnproto+***@googlegroups.com.
Visit this group at https://groups.google.com/group/capnproto.
Kenton Varda
2018-05-15 02:12:51 UTC
Permalink
There's no need for a VectorInputStream because you can use
ArrayInputStream with vec.asPtr() (returns an ArrayPtr).

-Kenton
Post by max
Hi Kenton,
thanks a lot. It‘s very helpful.
it has kj::VectorOutputStream,but no kj::VectorInputStream, i dont know
why.it confuses me.
i have to write a custom implementation
圚 2018幎5月15日星期二 UTC+8䞊午6:22:04Kenton Varda写道
Post by 'Kenton Varda' via Cap'n Proto
Hi Max,
You'll need to write a custom implementation of the kj::OutputStream
interface, then pass it to `writePackedMessage()`. Or, you could use
kj::ArrayOutputSteam or kj::VectorOutputStream, if you just want to write
to an in-memory byte array.
-Kenton
Post by max
I am reading the code,
i can write a message to the file,but how can i serialize the message to
stream?
use writePackedMessage?
i just want to serialize the message ,but dont write the serialized
message to file ?
can you help me ?
--
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
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
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 capnproto+***@googlegroups.com.
Visit this group at https://groups.google.com/group/capnproto.
Loading...