Re: [protobuf] Store number of messages

2011-03-04 Thread Henner Zeller
Varint does an encoding whose length changes with the size of the number - hence the name. So it can use between 1 and 10 bytes. So when the value _events_written changes, re-writing the same number at the beginning of the file will use a different number of bytes. If you want to write a number th

[protobuf] vs 2010 errors

2011-03-04 Thread namsaray
Hi all, I tried compiling protobuf with vs 2005 and vs 2008, the result is the same: test-lite - PASS tests - [ RUN ] CommandLineInterfaceTest.HelpText libprotobuf ERROR u:\data\code.c++\c++.util.dev\protobuf-2.4.0a\src \google\proto buf\compiler\command_line_interface_unittest.cc:287] Plugin

Re: [protobuf] RPC Methods

2011-03-04 Thread Jason Hsueh
http://code.google.com/apis/protocolbuffers/docs/proto.html#services describes how to define services. However, protobuf does not provide an RPC implementation. You may set the file option {lang}_generic_services = true to have the protocol compiler generate a stub that can be used to integrate wit

[protobuf] RPC Methods

2011-03-04 Thread Joshua Partogi
Hi there, Is it possible to define RPC methods in protobuf? From what I am reading it seems that protobuf is only limited to data structured data serializer. Is there any documentation I read about RPC methods in protobuf if any is available? Thank you for the assistance. Kind regards, Joshua.

[protobuf] Store number of messages

2011-03-04 Thread ksamdev
I have an application where number of messages is a priory unknown. I can open output file and write 0 in the beginning: Writer::Writer(const string &filename): _output(filename.c_str(), ios::out | ios::trunc | ios::binary), _events_written(0) { _raw_out.reset(new ::google::protobuf:

[protobuf] Re: Chunking a large message

2011-03-04 Thread Linus
Thanks Evan. Your response makes some things clear to me. I meant to say I'd like chunks of 1MB ( I re-read my email and realize it wasn't worded properly). I now have some ideas that I'm going to try out. Thanks again! On Mar 4, 8:37 am, Evan Jones wrote: > On Mar 3, 2011, at 15:53 , Linus wr

Re: [protobuf] RuntimeException while parsing back the byte[] to protocol buffer message instance! (deserialization)

2011-03-04 Thread Aditya Narayan
Thanks Evan Seems like I am missing some files. I have just created a .proto file and compiled it with protoc to get generated java files. I got .java file compiled and put it with the java's source folder from protobuf 2.4.a in my project folder. But some of the class dependency of the files

Re: [protobuf] RuntimeException while parsing back the byte[] to protocol buffer message instance! (deserialization)

2011-03-04 Thread Evan Jones
On Mar 4, 2011, at 11:11 , Aditya Narayan wrote: Exception in thread "main" java.lang.RuntimeException: Uncompilable source code This error means there is a build problem in your Eclipse project. You are trying to call some code that is not building compiled correctly. Fix your bui

Re: [protobuf] Chunking a large message

2011-03-04 Thread Evan Jones
On Mar 3, 2011, at 15:53 , Linus wrote: I am wondering if there are any examples of chunking large PB messages (about 1MB) into smaller chunks, to transmit over the wire. This is going to be pretty application specific. Typically it involves taking one message with a huge repeated field and s

[protobuf] RuntimeException while parsing back the byte[] to protocol buffer message instance! (deserialization)

2011-03-04 Thread Aditya Narayan
I tried following code for encoding and decoding. Decoding from byte[] fails, however. Code:- public static void test(){ Comment comment = Comment.newBuilder() .setCommentBody("This is 1st comment") .build(); byte[] bytes = comment.toByteArray

[protobuf] RuntimeException while parsing back the byte[] to protocol buffer message instance! (deserialization)

2011-03-04 Thread Aditya Narayan
I tried following code for encoding and decoding. Decoding from byte[] fails, however. Code:- public static void test(){ Comment comment = Comment.newBuilder() .setCommentBody("This is 1st comment") .build(); byte[] bytes = comment.toByteArray

Re: [protobuf] How to get the byte[] from a serialized data ?

2011-03-04 Thread Evan Jones
On Mar 4, 2011, at 7:15 , Aditya Narayan wrote: I have created .proto files and compiled them to get the generated classes. Also I can build the message objects using the setters & finally build() method. But to store it to database, I need serialized data as byte[] or byte buffers. How do I

[protobuf] Re: How to use the FieldOptions in java

2011-03-04 Thread Ben Wright
You need to use the field descriptor for the field you want to look at. You can get ahold of the field descriptor by using "findFieldByName" or "findFieldByNumber" FieldDescriptor myFieldDescriptor = MyProtoFileClass.MyMessage.getDescriptor().findFieldByNumber(MyProtoFileClass.MyMessage.MYFIELD_F

[protobuf] How to use the FieldOptions in java

2011-03-04 Thread Harpreet
Hi, I was scanning the Language Guide and saw that there are simple ways to access the MessageOptions defined in the java code like: String value = MyProtoFile.MyMessage.getDescriptor().getOptions().getExtension(MyProtoFile.myOption); However if i have a field option like (using the e.g. in Lang

[protobuf] How to get the byte[] from a serialized data ?

2011-03-04 Thread Aditya Narayan
I am trying to use Protocol buffers to store serialized data in Database for a web application built in java. I have created .proto files and compiled them to get the generated classes. Also I can build the message objects using the setters & finally build() method. But to store it to database