Help GzipInputStream

78 views
Skip to first unread message

David Granados

unread,
Jan 21, 2013, 6:53:28 AM1/21/13
to prot...@googlegroups.com
Hello.

I compressed a proto object: Mail, in a file named : file.sav.

Now i need get the proto object mail again, from the file.sav.

 I'm tying some like:
 google::protobuf::io::FileInputStream file_stream(filedescriptor);
 google::protobuf::io::GzipInputStream gzip_stream(&file_stream, GzipInputStream::GZIP);

I don't know how deserializate from stream to object Mail.

Regards.
      

Feng Xiao

unread,
Jan 21, 2013, 7:36:10 AM1/21/13
to David Granados, prot...@googlegroups.com
On Mon, Jan 21, 2013 at 7:53 PM, David Granados <deiv...@gmail.com> wrote:
Hello.

I compressed a proto object: Mail, in a file named : file.sav.

Now i need get the proto object mail again, from the file.sav.

 I'm tying some like:
 google::protobuf::io::FileInputStream file_stream(filedescriptor);
 google::protobuf::io::GzipInputStream gzip_stream(&file_stream, GzipInputStream::GZIP);
Wrap it with a CodedInputStream and call mail.ParseFromCodedInputStream() to parse from the stream.
 

I don't know how deserializate from stream to object Mail.

Regards.

      

--
You received this message because you are subscribed to the Google Groups "Protocol Buffers" group.
To view this discussion on the web visit https://groups.google.com/d/msg/protobuf/-/PiBkAgKCjgUJ.
To post to this group, send email to prot...@googlegroups.com.
To unsubscribe from this group, send email to protobuf+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.

David Granados

unread,
Jan 21, 2013, 8:15:42 AM1/21/13
to prot...@googlegroups.com
Thanks XIAO.

Finally i do:
 ZeroCopyInputStream* input = new google::protobuf::io::FileInputStream(filedescriptor);
 google::protobuf::io::GzipInputStream gzip_stream(input, GzipInputStream::GZIP);
 Mail.ParseFromZeroCopyStream(&gzip_stream);


And this work perfectly.  I paste the code for someone need.
Reply all
Reply to author
Forward
0 new messages