On Wed, Jan 30, 2013 at 12:45 PM, David Granados <deivi...@gmail.com> wrote:
If i write the size and is 192, compress does not work.
In the code you attached, you are writing the *uncompressed* size to cout:
std::cout << gzip_stream.ByteCount()<<std::endl;
GzipOutputStream::ByteCount() returns the number of uncompressed bytes
written *to* the stream, not the number of compressed bytes that were
written to the underlying stream. If you want to count the compressed
bytes, call ByteCount() on the underlying stream. (i.e. output->ByteCount()
in your code)
Also, if you want to eventually end up with a std::string containing the
compressed output, why don't you use StringOutputStream? Something like
GzipOutputStream compressingStream(compressedStream, options);
pProto.SerializeToZeroCopyStream(&compressingStream); // error checks
omitted for brevity
// let destructors do stream cleanup
You received this message because you are subscribed to the Google Groups
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
To post to this group, send email to firstname.lastname@example.org.
Visit this group at http://groups.google.com/group/protobuf?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.