Issue 429 in protobuf: Support for ByteBuffer in java, in parseFrom the generated message class and mergeFrom in the builder class.

1,074 views
Skip to first unread message

prot...@googlecode.com

unread,
Oct 31, 2012, 4:37:28 AM10/31/12
to prot...@googlegroups.com
Status: New
Owner: liuj...@google.com
Labels: Type-Defect Priority-Medium

New issue 429 by yijinzho...@gmail.com: Support for ByteBuffer in java, in
parseFrom the generated message class and mergeFrom in the builder class.
http://code.google.com/p/protobuf/issues/detail?id=429

The generated java message classes today contains overloaded static
parseFrom(...) method thats a byte[],ByteString as parameter etc...
and the corresponding mergeFrom in the Builder class.

I think it would useful to support javas ByteBuffer or a byte[] and a
startOffset and endOffset, the underlying implementation would just read
the array of ByteBuffer to limit, in the case of ByteBuffer, and endOffset
in the other case. The reason is the ByteBuffer could be reused over and
over by resetting and setting the limit.
hopefully this change is not a big thing.

so the proposed change would be adding parseFrom(ByteBuffer data); and
parseFrom(byte[] data,int startOffset, int endOffset), and the
corresponding mergeFrom methods in the Builder class.

prot...@googlecode.com

unread,
Feb 1, 2013, 12:55:57 PM2/1/13
to prot...@googlegroups.com
Updates:
Status: Invalid

Comment #1 on issue 429 by xiaof...@google.com: Support for ByteBuffer in
java, in parseFrom the generated message class and mergeFrom in the
builder class.
http://code.google.com/p/protobuf/issues/detail?id=429

Parsing methods like parseFrom(byte[] data, int off, int len) is already
available. See:
http://code.google.com/p/protobuf/source/browse/trunk/java/src/main/java/com/google/protobuf/Parser.java#127


Reply all
Reply to author
Forward
0 new messages