Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatible with C++ spec v2? #137

Open
sgammon opened this issue Jan 16, 2024 · 3 comments
Open

Compatible with C++ spec v2? #137

sgammon opened this issue Jan 16, 2024 · 3 comments

Comments

@sgammon
Copy link

sgammon commented Jan 16, 2024

I'm curious if this package has yet adopted the v2 branch of capnproto upstream. Say you have a message you have created in C++, like:

// message = ... is a builder of some kind
VectorOutputStream stream;
capnp::MallocMessageBuilder builder;
builder.setRoot(message.asReader());
capnp::writeMessage(stream, builder.getSegmentsForOutput());
ArrayPtr<byte> p_bytes = stream.getArray();

And now, you take those p_bytes and transport them to Java, and read them. Is this supported? If so, is that the right way to do it?

@sgammon
Copy link
Author

sgammon commented Jan 16, 2024

cc / @dwrensha

@dwrensha
Copy link
Member

I'm curious if this package has yet adopted the v2 branch of capnproto upstream.

The capnproto-c++ v2 branch may have breaking changes in its C++ API, but it does not change the wire protocol. So it might make the schema compiler plugin capnpc-java fail to compile (I haven't checked, but we can always stick to v1), but it won't make the generated java code nor the capnproto-java runtime obsolete.

And now, you take those p_bytes and transport them to Java, and read them. Is this supported? If so, is that the right way to do it?

Yes, you can put those bytes into an ArrayInputStream and then call Serialize.read() on it.

@sgammon
Copy link
Author

sgammon commented Jan 16, 2024

Thanks for the quick response, I'll give it a try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants