Re: [protobuf] GZip Stream examples

2011-03-09 Thread ksamdev
Well, I have to update the very first value, , after all messages are 
written. I do not know a priory how many messages will be stored. Therefore, 
I use fstream::fseekp(0) to move the write pointer before the file is closed 
and update the value. Of course, the number is written without optimizations 
with WriteLittleEndian32(...).

It does not seem I can do the same with Gzip. The number would be compressed 
differently depending on its value and therefore may have different length.

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



Re: [protobuf] GZip Stream examples

2011-03-08 Thread Jason Hsueh
I don't think there are any problems with having a raw prefix, and just
wrapping GZipInputStream around the raw input stream after it's been read,
but that sounds pretty messy. It seems easier to just make the whole thing a
gzip stream - it can then also be easily read by other tools that use zlib.

On Tue, Mar 8, 2011 at 8:09 PM, ksamdev  wrote:

> Cool, it worked great.
>
> Can I mix Raw out and Gzip out in the file?
>
> Say, I'd like to write a raw number (4 bytes) at the beginning of the file
> and then add the message through the Gzip stream. Visually, my file would
> look like:
>
> .
>
> where first  - 4 bytes written with raw_out and the rest:
> GG - with Gzip Stream.
>
> Of course, the reading sequence would be:
>
> 1. read 
> 2. keep reading the rest G through Gzip Stream.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> 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 protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] GZip Stream examples

2011-03-08 Thread ksamdev
Cool, it worked great.

Can I mix Raw out and Gzip out in the file?

Say, I'd like to write a raw number (4 bytes) at the beginning of the file 
and then add the message through the Gzip stream. Visually, my file would 
look like:

.

where first  - 4 bytes written with raw_out and the rest: 
GG - with Gzip Stream.

Of course, the reading sequence would be:

1. read 
2. keep reading the rest G through Gzip Stream.

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



Re: [protobuf] GZip Stream examples

2011-03-08 Thread Jason Hsueh
You wrap GZipOutputStream around your underlying output stream, and use the
GZipOutputStream with CodedOutputStream instead:

On Tue, Mar 8, 2011 at 10:10 AM, ksamdev  wrote:

> Hi,
>
> Are there any examples on how to use GzipOUtputStream in ProtoBuf?
> I've manages so far combo:
>
>  _raw_out.reset(new
> ::google::protobuf::io::OstreamOutputStream(&_output));
>
_compressed_out.reset(new
::google::protobuf::io::GZipOutputStream(_raw_out.get()));

>  _coded_out.reset(new
> ::google::protobuf::io::CodedOutputStream(_compressed_out.get()));
>
> (both objects are boost::shared_pointer's).
>
> How am I supposed to use the GzipOutputStream here?
>
> thanks.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> 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 protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] Gzip

2010-07-29 Thread Jason Hsueh
(adding the mailing list back)

You may need to run the configure command with --with-zlib=[path] or
--system-zlib.

Yes, you can use GzipOutputStream with CodedOutputStream.

On Thu, Jul 29, 2010 at 1:16 PM, Julian González wrote:

> Well, the thing is that I try to use them but first I got an error telling
> me zlib.h could not be found and I was also wondering if I can use
> GzipOutputStream along with CodedOutputStream?
>
> El 29 de julio de 2010 14:59, Jason Hsueh  escribió:
>
> What exactly do you want to know about them? There are various details
>> about how they adapt zlib to the ZeroCopy*Stream interfaces, but as a client
>> you shouldn't need to worry about that. You can use them just like any other
>> ZeroCopyStream.
>>
>>
>> On Thu, Jul 29, 2010 at 8:58 AM, Julian González wrote:
>>
>>> How the GzipOutputStream and GzipInputStream works?
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Protocol Buffers" group.
>>> To post to this group, send email to proto...@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> protobuf+unsubscr...@googlegroups.com
>>> .
>>> 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 proto...@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] Gzip

2010-07-29 Thread Jason Hsueh
What exactly do you want to know about them? There are various details about
how they adapt zlib to the ZeroCopy*Stream interfaces, but as a client you
shouldn't need to worry about that. You can use them just like any other
ZeroCopyStream.

On Thu, Jul 29, 2010 at 8:58 AM, Julian González wrote:

> How the GzipOutputStream and GzipInputStream works?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to proto...@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com
> .
> 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 proto...@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.