Indeed, CodedOutputStream and CodedInputStream aren't presently available in Python. Want to add it?
You should also be able to implement what you want without the help of these classes. http://code.google.com/apis/protocolbuffers/docs/techniques.html#streamingdescribes what to do - once you have the size delimiters you can read just enough to parse a single message, rather than reading the entire file into memory. On Wed, Dec 9, 2009 at 9:23 AM, Mark Dredze <[email protected]> wrote: > Hi All, > > I have what I believe is a simple task: write multiple protocol > buffers to a single file and then read them back sequentially. When > reading, I should not have to load the entire file in memory but read > each protobuf object one at a time (with some buffering). An example > application would to be store a large number of documents in a file, > where each document is a single protobuf. > > This functionality seems to be provided in Java using writeTo > (OutputStream output) and parseFrom(InputStream input). However, it > seems to be missing from Python: > > http://groups.google.com/group/protobuf/browse_thread/thread/cfe1955729077132/c8ccf86adecf3b47?lnk=gst > > http://groups.google.com/group/protobuf/browse_thread/thread/838eb489871a92df/b2863c8b9ebfc433 > > Have people come up with a solution to this problem for Python? One > approach would be to port CodedOutputStream and CodedInputStream to > Python. > > I am wondering if anyone has developed an approach to deal with this. > > Best, > Mark > > -- > > You received this message because you are subscribed to the Google Groups > "Protocol Buffers" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<protobuf%[email protected]> > . > 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
