Method: FileUtils.compare_stream
- Defined in:
- lib/fileutils.rb
permalink .compare_stream(a, b) ⇒ Object
Returns true if the contents of a stream a
and b
are identical.
837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 |
# File 'lib/fileutils.rb', line 837 def compare_stream(a, b) bsize = fu_stream_blksize(a, b) if RUBY_VERSION > "2.4" sa = String.new(capacity: bsize) sb = String.new(capacity: bsize) else sa = String.new sb = String.new end begin a.read(bsize, sa) b.read(bsize, sb) return true if sa.empty? && sb.empty? end while sa == sb false end |