Filter class to wrap IO objects and uncompress DEFLATE'd files
This is used for reading “bigfile” objects generated by the (deprecated) mogtool(1)
# File lib/mogilefs/bigfile/filter.rb, line 29 def flush @flushed_bytes = @io.write(@zi.finish) if @zi @io.flush end
# File lib/mogilefs/bigfile/filter.rb, line 21 def md5_check!(expect) return unless @md5 current = @md5.hexdigest current == expect or raise MogileFS::ChecksumMismatchError, "#{current} != #{expect}" @md5.reset end
# File lib/mogilefs/bigfile/filter.rb, line 34 def write(buf) if nil == @zi if @info[:compressed] && INFLATABLE_TYPES.include?(@info[:type]) && buf.bytesize >= 2 && buf[0,2] != GZIP_HEADER @zi = Zlib::Inflate.new # mogtool(1) seems to have a bug that causes it to generate bogus # MD5s if zlib deflate is used. Don't trust those MD5s for now... @md5 = nil else @zi = false end end if @zi buf = @zi.inflate(buf) else @md5 << buf end @io.write(buf) end
Generated with the Darkfish Rdoc Generator 2.