Project

General

Profile

Bug #4360 ยป t.rb

Test file for reading concatenated gzip streams - drbrain (Eric Hodel), 02/03/2011 10:31 AM

 
1
require 'stringio'
2
require 'zlib'
3

    
4
zio = StringIO.new
5

    
6
io = Zlib::GzipWriter.new zio
7
io.write 'aaaa'
8
io.finish
9

    
10
io = Zlib::GzipWriter.new zio
11
io.write 'bbbb'
12
io.finish
13

    
14
zio.rewind
15

    
16
io = Zlib::GzipReader.new zio
17
puts io.read
18
unused = io.unused
19
io.finish
20

    
21
zio.pos -= unused.length
22

    
23
io = Zlib::GzipReader.new zio
24
puts io.read
25
unused = io.unused
26
io.finish
27