Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.ruby > #6522
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!newsfeed.straub-nv.de!uucp.gnuu.de!xts.gnuu.de!.POSTED!not-for-mail |
|---|---|
| From | Simon Krahnke <overlord@gmx.li> |
| Newsgroups | comp.lang.ruby |
| Subject | Re: Zlib::GzipReader doesn't work as expected |
| Date | Thu, 26 Apr 2012 22:02:07 +0200 |
| Organization | there's no z in organisation |
| Lines | 38 |
| Message-ID | <87aa1y6z40.fsf@xts.gnuu.de> (permalink) |
| References | <jn8e9q$sg3$1@online.de> <9vr04hFh0cU1@mid.individual.net> <jnb61g$7ka$1@online.de> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| X-Trace | xts.gnuu.de 1335470527 24615 172.19.115.2 (26 Apr 2012 20:02:07 GMT) |
| X-Complaints-To | usenet@nowhere.invalid |
| User-Agent | Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) |
| Cancel-Lock | sha1:PUTfW7d7ZNGrEOmvVRq5QC7qCWM= |
| Xref | csiph.com comp.lang.ruby:6522 |
Show key headers only | View raw
* Thomas Wolf <thomasw@viacanale.de> (11:54) schrieb: > require 'stringio' This is unneeded. >require 'zlib' > >def inflate(filename) > File.open(filename) do |file| > zio = file You could just use | zio | instead of |file| and get rid of the assignment. > loop do > io = Zlib::GzipReader.new zio > puts io.read puts here will put another "\n" at the end of the output, use print instead. > unused = io.unused > io.finish > break if unused.nil? > zio.pos -= unused.length > end > end >end > >inflate "foo.gz" Note that as said in the thread this works only for files and other seekable sources. So "(seq 1 5 | gzip; seq 6 10 | gzip) | yourscript.rb" won't work. mfg, simon .... hth
Back to comp.lang.ruby | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Zlib::GzipReader doesn't work as expected Thomas Wolf <thomasw@viacanale.de> - 2012-04-25 10:57 +0200
Re: Zlib::GzipReader doesn't work as expected Robert Klemme <shortcutter@googlemail.com> - 2012-04-25 21:03 +0200
Re: Zlib::GzipReader doesn't work as expected Simon Krahnke <overlord@gmx.li> - 2012-04-25 21:55 +0200
Re: Zlib::GzipReader doesn't work as expected Thomas Wolf <thomasw@viacanale.de> - 2012-04-26 11:54 +0200
Re: Zlib::GzipReader doesn't work as expected Simon Krahnke <overlord@gmx.li> - 2012-04-26 22:02 +0200
Re: Zlib::GzipReader doesn't work as expected Simon Krahnke <overlord@gmx.li> - 2012-04-25 21:53 +0200
csiph-web