Re: CodedInputStream.readMessage(Builder,ExtensionRegistry)
I don't see an obvious reason why this shouldn't work (other than that your example code says toArray where I think you meant toByteArray). Can you write a small example program demonstrating the problem which I could debug? On Sat, Feb 21, 2009 at 5:27 PM, Nathaniel bison...@gmail.com wrote: I'm having a hard time with the readMessageFunction on CodedInputStream CodedInputStream.readMessage(Builder,ExtensionRegistry) org.apache.mina.filter.codec.ProtocolDecoderException: com.google.protobuf.InvalidProtocolBufferException: Protocol message tag had invalid wire type. (Hexdump: 6F 67 6C 65 2E 63 6F 6D) My code looked something like this before I ripped it out to simple use IngestProto.ShareLocation.parseFrom() IngestProto.ShareLocation.Builder builder = IngestProto.ShareLocation.newBuilder(); builder.setUrl( http://google.com;); IngestProto.ShareLocation.Builder builder2 = IngestProto.ShareLocation.newBuilder(); CodedInputStream cis = CodedInputStream.newInstance(builder.build ().toArray()); cis.readMessage( builder2, ExtensionRegistry.getEmptyRegistry()); Any ideas? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: CodedInputStream.readMessage(Builder,ExtensionRegistry)
Oh wait, I see the problem. All of CodedInputStream's readBlah() methods are for reading *fields* of an outer message. So, readMessage() reads a message-typed field, which should be a size followed by some bytes. You're trying to feed it a raw message (just the bytes without the size). You should really just stick to using parseFrom(). Is there some reason you were trying to use CodedInputStream.readMessage() instead? On Sun, Feb 22, 2009 at 12:40 AM, Kenton Varda ken...@google.com wrote: I don't see an obvious reason why this shouldn't work (other than that your example code says toArray where I think you meant toByteArray). Can you write a small example program demonstrating the problem which I could debug? On Sat, Feb 21, 2009 at 5:27 PM, Nathaniel bison...@gmail.com wrote: I'm having a hard time with the readMessageFunction on CodedInputStream CodedInputStream.readMessage(Builder,ExtensionRegistry) org.apache.mina.filter.codec.ProtocolDecoderException: com.google.protobuf.InvalidProtocolBufferException: Protocol message tag had invalid wire type. (Hexdump: 6F 67 6C 65 2E 63 6F 6D) My code looked something like this before I ripped it out to simple use IngestProto.ShareLocation.parseFrom() IngestProto.ShareLocation.Builder builder = IngestProto.ShareLocation.newBuilder(); builder.setUrl( http://google.com;); IngestProto.ShareLocation.Builder builder2 = IngestProto.ShareLocation.newBuilder(); CodedInputStream cis = CodedInputStream.newInstance(builder.build ().toArray()); cis.readMessage( builder2, ExtensionRegistry.getEmptyRegistry()); Any ideas? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
CodedInputStream.readMessage(Builder,ExtensionRegistry)
I'm having a hard time with the readMessageFunction on CodedInputStream CodedInputStream.readMessage(Builder,ExtensionRegistry) org.apache.mina.filter.codec.ProtocolDecoderException: com.google.protobuf.InvalidProtocolBufferException: Protocol message tag had invalid wire type. (Hexdump: 6F 67 6C 65 2E 63 6F 6D) My code looked something like this before I ripped it out to simple use IngestProto.ShareLocation.parseFrom() IngestProto.ShareLocation.Builder builder = IngestProto.ShareLocation.newBuilder(); builder.setUrl( http://google.com;); IngestProto.ShareLocation.Builder builder2 = IngestProto.ShareLocation.newBuilder(); CodedInputStream cis = CodedInputStream.newInstance(builder.build ().toArray()); cis.readMessage( builder2, ExtensionRegistry.getEmptyRegistry()); Any ideas? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---