Kenton Varda wrote:
> On Tue, Aug 18, 2009 at 6:55 PM, Oliver Jowett <oliver.jow...@gmail.com
> <mailto:oliver.jow...@gmail.com>> wrote:
> 
> 
>     Hi
> 
>     Using 2.2.0, the compiler doesn't seem to be generating Java code for
>     the parseFrom(byte[],int,int) and
>     parseFrom(byte[],int,int,ExtensionRegistryLite) static methods.
> 
> 
> Did it ever generate those methods?  I don't remember if it did, but I
> definitely don't remember removing them.

I don't think so - I just tried to use them based on the documentation
saying "there's a parseFrom() variant for each mergeFrom()" and ran into
compile errors. I really did need to parse from a partial array there -
it was a section of a NIO buffer's backing array.

> Arguably your code should look like:
> 
>   message = builder.mergeFrom(array, offset, length).buildPartial();
>   if (!message.isInitialized()) {
>     throw new InvalidProtocolBufferException(...);
>   }
> 
> It's a little bit nicer than the try/catch...

Unfortunately, this doesn't give you the nice list of missing fields
that parseFrom() generates.

-O

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to