I have a stream of bytes in my Ruby-script and I'd like to output the values to the console.
我的Ruby脚本中有一个字节流,我想将值输出到控制台。
1 个解决方案
#1
15
If you read your stream in chunks of bytes, then you could use String#unpack:
如果你用大块的字节读取你的流,那么你可以使用String#unpack:
while buffer = io.read
str << buffer.unpack('H*')
end
#1
15
If you read your stream in chunks of bytes, then you could use String#unpack:
如果你用大块的字节读取你的流,那么你可以使用String#unpack:
while buffer = io.read
str << buffer.unpack('H*')
end