#<Zlib::BufError: buffer error>

O

Oleg Igor

require "zlib"

def inflate(string)
zstream = Zlib::Inflate.new
buf = zstream.inflate(string)
zstream.finish
zstream.close
buf
end

Work fine with ruby 1.8, and do not work in ruby 1.9
#<Zlib::BufError: buffer error>
what is wrong ?

Oleg.
 
O

Oleg Igor

Oleg said:
require "zlib"

def inflate(string)
zstream = Zlib::Inflate.new
buf = zstream.inflate(string)
zstream.finish
zstream.close
buf
end

Work fine with ruby 1.8, and do not work in ruby 1.9
#<Zlib::BufError: buffer error>
what is wrong ?

Oleg.

Sorry, I'ts my bug. Subject closed.

Thanks
Oleg.
 
7

7stud --

Oleg said:
require "zlib"

def inflate(string)
zstream = Zlib::Inflate.new
buf = zstream.inflate(string)
zstream.finish
zstream.close
buf
end

Work fine with ruby 1.8, and do not work in ruby 1.9
#<Zlib::BufError: buffer error>
what is wrong ?

Oleg.

require "zlib"

def deflate(string)
zipper = Zlib::Deflate.new
data = zipper.deflate("hello world", Zlib::FINISH)
end

def inflate(string)
zstream = Zlib::Inflate.new
buf = zstream.inflate(string)
zstream.finish
zstream.close
buf
end

compressed = deflate("hello world")
p compressed

uncompressed = inflate(compressed)
puts uncompressed


$ ruby19 -v
ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-darwin8.11.1]

$ ruby19 r1test.rb
"x\x9C\xCBH\xCD\xC9\xC9W(\xCF/\xCAI\x01\x00\x1A\v\x04]"
hello world
 

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

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top