# File lib/HostSystem.rb, line 34
def HostSystem.hex_dump(buffer)
        s=""
                (0..(buffer.length/16)).each {|line_number|
                         lhs=""
                         rhs=""
                         start_byte=line_number*16
                         line=buffer[start_byte,16]
                        if line.length>0 then
                                 line.each_byte {|byte|
                                          lhs+= sprintf("%02X ", byte)
                                          rhs+= to_ascii(byte).sub(/[\x00-\x1f]/,'.')
                             }
                                lhs+=" "*(16-line.length)*3
                                s+=sprintf("%02X\t%s %s\n",start_byte,lhs,rhs)
                        end
                }
                s
end