Hello.
I sucesfully compress/decompress a proto object using files, but i now need
to do it same, but using string (no using files).
This code works fine for files:
google::protobuf::io::FileOutputStream file_stream(filedescriptor);
GzipOutputStream::Options options;
options.format = GzipOutputStream::GZIP;
options.compression_level = NIVEL_COMPRESION;
google::protobuf::io::GzipOutputStream gzip_stream(&file_stream, options);
I was transformed this code in another to work with string:
const unsigned bufLength = 256;
unsigned char buffer[bufLength];
std::cout << buffer << std::endl;
// Obtenemos un array del proto serializado
ZeroCopyOutputStream* output = new
google::protobuf::io::ArrayOutputStream(buffer,bufLength);
// Introducimos las opciones de compression
GzipOutputStream::Options options;
options.format = GzipOutputStream::GZIP;
options.compression_level = NIVEL_COMPRESION;
google::protobuf::io::GzipOutputStream gzip_stream(output,options);
if (!pProto.SerializeToZeroCopyStream(&gzip_stream))
{
std::cerr << "Error comprimiendo el proto a string." << std::endl;
}
buffer is void. Where can be the error?
Regards.
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/protobuf?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.