public Method

FileUtils.compare_stream(a, b)

Returns true if the contents of a stream a and b are identical.

Source Code

# File fileutils.rb, line 810
def compare_stream(a, b)
  bsize = fu_stream_blksize(a, b)
  sa = sb = nil
  while sa == sb
    sa = a.read(bsize)
    sb = b.read(bsize)
    unless sa and sb
      if sa.nil? and sb.nil?
        return true
      end
    end
  end
  false
end
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.