module PatchELF::Refinements
TODO: refactor buf_* methods here TODO: move all refinements into a seperate file / helper file. refinements for cleaner syntax / speed / memory optimizations
Public Instance Methods
fill(char, nbytes)
click to toggle source
behaves like C memset. Equivalent to calling stream.write(char * nbytes) the benefit of preferring this over `stream.write(char * nbytes)` is only when data to be written is large. @param [String] char @param [Integer] nbytes @return
# File lib/patchelf/alt_saver.rb, line 23 def fill(char, nbytes) at_once = Helper::PAGE_SIZE pending = nbytes if pending > at_once to_write = char * at_once while pending >= at_once write(to_write) pending -= at_once end end write(char * pending) if pending.positive? end