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

Java parseDelimitedFrom CodedInputStream #568

Closed
yeison opened this issue Jul 6, 2015 · 2 comments
Closed

Java parseDelimitedFrom CodedInputStream #568

yeison opened this issue Jul 6, 2015 · 2 comments

Comments

@yeison
Copy link

yeison commented Jul 6, 2015

Why is it not possible to use parseDelimitedFrom on a CodedInputStream?

e.g.

parser.parseDelimitedFrom(CodedInputStream cis);

@kentonv
Copy link
Contributor

kentonv commented Aug 12, 2015

If you have a CodedInputStream already, then it's pretty easy to read the size followed by the content directly. I originally created parseDelimitedFrom() mainly because reading a delimited message from a raw InputStream -- without accidentally reading too much -- is actually pretty tedious. You can't just wrap it in a CodedInputStream because CodedInputStream will immediately read a large buffer which might go past the end of the message, and the goal here was to allow people to read the message and then go back to reading from their simple InputStream after.

(I don't work on protobufs anymore, though, and I don't have a strong opinion on whether or not such an overload should be added for convenience; that's up to the current team.)

@haberman
Copy link
Member

haberman commented Mar 7, 2017

As Kenton mentioned, it is pretty easy to do this manually. I don't think it's worth the extra API surface to add this. Especially since adding thing to one language (like Java) inevitably turns up requests to add it to other languages (like C++).

@haberman haberman closed this as completed Mar 7, 2017
adellahlou pushed a commit to adellahlou/protobuf that referenced this issue Apr 20, 2023
adellahlou pushed a commit to adellahlou/protobuf that referenced this issue Apr 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants