Zlib::GzipReader/Writer and strings

J

jim

Hi

Is there a way for Zlib::GzipReader or GzipWriter
to read and write to a string as a StringIO object?

I have tried and am not having any luck.

I am using Ruby 1.8.1.

Thanks
 
M

Mauricio Fernández

Hi

Is there a way for Zlib::GzipReader or GzipWriter
to read and write to a string as a StringIO object?

I have tried and am not having any luck.

I am using Ruby 1.8.1.

Just doing Zlib::GzipReader.new(anIO) (where anIO responds to #read
with the same semantics as IO) works for me.
=> "foofoofoofoofoofoofoofoofoofoo"
 
J

jim

* Mauricio Fernández said:
Just doing Zlib::GzipReader.new(anIO) (where anIO responds to #read
with the same semantics as IO) works for me.

Thanks. I think I was missing the b.finish statement.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,997
Messages
2,570,241
Members
46,833
Latest member
BettyeMacf

Latest Threads

Top