Class: ExtremeUnZip
- Inherits:
-
Object
- Object
- ExtremeUnZip
- Defined in:
- lib/extremeunzip.zzaqsu.rb
Instance Method Summary collapse
Instance Method Details
#exuz(rootPath) ⇒ Object
解压
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/extremeunzip.zzaqsu.rb', line 10 def exuz(rootPath) result = true # 解压结果 currentBlockFile = File.new(rootPath, 'rb') # 打开文件 @wholeFileContent = currentBlockFile.read # 读取全部内容 currentBlockFile.close # 关闭文件 wholeCborByteArray = @wholeFileContent # 从第5个到末尾 begin # 可能出错。 = {:tolerant => true} wholeCbor = CBOR.decode(wholeCborByteArray, ) # 解码 puts wholeCbor x=1..wholeCbor.length y=wholeCbor.map { |event| event["optimisticScore"] } y1=wholeCbor.map { |event| event["speciesScore"] } puts x puts y xString="" x.each { |value| xString=xString+"#{value}," } xString="[#{xString}]" puts xString yString="" y.each { |value| yString=yString+"#{value}," } yString="[#{yString}]" puts yString yString1="" y1.each { |value| yString1=yString1+"#{value}," } yString1="[#{yString1}]" puts yString1 result =true # 解压成功 rescue EOFError => e # 文件内容提前到末尾。一般是压缩包文件未传输完全 。 puts "Error: the exz file may be incomplete." # 报告错误。文件可能不完整。 result = false # 失败 end #begin # 可能出错。 end |