[protobuf] does android sdk include protobuf lib?
I want to use protobuf in an android project, but when I generated a jar for all protocols I used, I found that it's 300KB large. So does android have the plan to migrate protobuf? thx -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to proto...@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.
[protobuf] Issue 231 in protobuf: python SerializePartialToString raises 'Required field missing' in case of nested required fields
Status: New Owner: ken...@google.com Labels: Type-Defect Priority-Medium New issue 231 by krumpligyar: python SerializePartialToString raises 'Required field missing' in case of nested required fields http://code.google.com/p/protobuf/issues/detail?id=231 The following call stack should never happen. (SerializePartialToString calls SerialzeToString and then raises, because required fields are missing.) File /usr/lib/pymodules/python2.6/google/protobuf/reflection.py, line 885, in SerializePartialToString field_descriptor, encoder) File /usr/lib/pymodules/python2.6/google/protobuf/reflection.py, line 802, in _SerializeValueToEncoder method(encoder, field_number, value) File /usr/lib/pymodules/python2.6/google/protobuf/internal/encoder.py, line 260, in AppendMessage self._stream.AppendRawBytes(msg.SerializeToString()) File /usr/lib/pymodules/python2.6/google/protobuf/reflection.py, line 847, in SerializeToString raise message_mod.EncodeError('\n'.join(errors)) EncodeError: Required field scarab.HashedInversion.inversion is not set. My proto looked like this: message Foo { required int32 i = 1; } message Bar { required Foo foo = 2; } I'm using python2.6 under ubuntu lynx. Thanks, Daniel -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to proto...@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: [protobuf] Serialize message in C++, parse using Java
On Wed, Oct 27, 2010 at 11:50 AM, Jun8 ctaski...@gmail.com wrote: I've Google for a day now and could not find full information on the following problem. I want to serialize protobuf messages in C++, send them to a JMS (using activemq-cpp API) and parse in my Java server. Based on what I found in my searches, here's my C++ function that serializes the message: /* * Serialize given protobuf message and send to Active MQ JMS using the producer. */ void MessageProducer::send( const diva::messaging::Message proto_mesg ) { using namespace google::protobuf::io; long bufLength = proto_mesg.ByteSize() + CodedOutputStream::VarintSize32( proto_mesg.ByteSize() ); unsigned char buf[bufLength]; ZeroCopyOutputStream* raw_output = new ArrayOutputStream( buf, bufLength ); CodedOutputStream* coded_output = new CodedOutputStream(raw_output); // Prepend the message size to wire message. coded_output-WriteVarint32( proto_mesg.ByteSize() ); You're writing the message size as a prefix to the message data here... proto_mesg.SerializeToCodedStream(coded_output); // Create an ACtive JMS message and insert task module information in header. cms::BytesMessage* message = m_session-createBytesMessage(); // Write serialized protobuf message to the JMS message and send. message-writeBytes( buf, 0, bufLength ); m_producer-send( message ); delete message; delete coded_output; delete raw_output; } And here's the part in Java that parses teh received messages from JMS: // Create a byte array for received message. BytesMessage receivedMessage = (BytesMessage)received_message; logger.info(received message in NAC); byte[] mesg_bytes = new byte[(int)receivedMessage.getBodyLength()]; int num_read = receivedMessage.readBytes(mesg_bytes); Presumably these bytes contain all the data that you wrote out, including the size prefix... if ( num_read != receivedMessage.getBodyLength() ) { throw new Exception(Error reading message into byte array); } // Create registry for all possible DIVA messages. ExtensionRegistry er = ExtensionRegistry.newInstance(); DivaBase.registerAllExtensions(er); // Parse the received message. diva.messaging.DivaBase.Message m = diva.messaging.DivaBase.Message.parseFrom( mesg_bytes, er ); ...but parseFrom expects only the message data, not a message length prefix. I'd just remove the WriteVarint32(proto_mesg.ByteSize()) call, since you are using a transport mechanism that has its own means for delimiting messages. Currently, I get Problem parsing message received in NAC: com.google.protobuf.InvalidProtocolBufferException: Protocol message end-group tag did not match expected tag. Problem parsing message received in NAC: java.lang.ClassCastException: org.apache.activemq.command.ActiveMQTextMessage cannot be cast to javax.jms.BytesMessage errors for each message and cannot see what I'm doing wrong. Thanks for any comments on the code and/or pointers you might provide. -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to proto...@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.comprotobuf%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/protobuf?hl=en. -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to proto...@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: [protobuf] New Ruby Protocol Buffers library
Looks like Kenton didn't get around to this, so I added it to the wiki. On Wed, Oct 27, 2010 at 11:48 AM, Brian Palmer br...@codekitchen.netwrote: I think just the github page for the project would be great. Thanks! http://github.com/mozy/ruby-protocol-buffers -- Brian On Oct 26, 2010, at 10:56 PM, Kenton Varda wrote: I'd like to add this to the third-party wiki, but I'm not sure which link to use. Can you suggest (or create) a general-purpose landing page? On Thu, Oct 21, 2010 at 10:02 AM, Brian Palmer br...@codekitchen.netwrote: Mozy has just open sourced their implementation of Protocol Buffers for Ruby. The implementation has been in use internally at Mozy for over a year. This implementation has put a lot of focus on serialization/deserialization performance, and completeness. The ruby protobuf compiler calls out to protoc to do the heavy lifting, so it's using the same parser as the official compiler. It looks like now there's a plugin system for protoc itself, so if we were writing this project today we probably would've just made the compile-to-ruby functionality a plugin. Enjoy! The repo: http://github.com/mozy/ruby-protocol-buffers The gem: https://rubygems.org/gems/ruby-protocol-buffers The docs: http://rubydoc.info/gems/ruby-protocol-buffers/0.8.4/frames -- Brian Palmer -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to proto...@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.comprotobuf%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/protobuf?hl=en. -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to proto...@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.comprotobuf%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/protobuf?hl=en. -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to proto...@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.