Re: [protobuf] Re: Map a delimited string to Message

2012-04-12 Thread Shrijeet Paliwal
Jason, Thanks for replying. Java API has parseDelimitedFrom method. I used it to parse it back. while ((record = LogRecord.parseDelimitedFrom(bufferIn)) != null) { StringBuffer sb = new StringBuffer(); for (Object value : record.getAllFields().values()) {

Re: [protobuf] Re: Map a delimited string to Message

2012-04-12 Thread Jason Hsueh
You won't be able to parse the data as a LogFile with the format you write, but if you are ok with manually parsing each delimited message, that approach will be fine. There are probably other folks who are more familiar with the Java internals and how to optimize for builder reuse etc. On Wed, A

Re: [protobuf] Re: Map a delimited string to Message

2012-04-11 Thread Jason Hsueh
Have you profiled this program? I would be surprised if protobuf code consumes a significant amount of time: all you are doing is setting the field values. If you want to minimize memory usage, you can probably flush your LogFile periodically to the stream: as long as you don't write anything else