Class: Aliyun::SnappyReader

Inherits:
Object
  • Object
show all
Defined in:
lib/aliyun/odps/tunnel/snappy_reader.rb

Class Method Summary collapse

Class Method Details

.load_snappyObject



13
14
15
16
17
# File 'lib/aliyun/odps/tunnel/snappy_reader.rb', line 13

def self.load_snappy
  require 'snappy'
rescue LoadError
  raise 'Install snappy to support x-snappy-framed encoding: https://github.com/miyucy/snappy'
end

.uncompress(data) ⇒ Object



6
7
8
9
10
11
# File 'lib/aliyun/odps/tunnel/snappy_reader.rb', line 6

def self.uncompress(data)
  load_snappy

  data.slice!(0, 18)
  Snappy.inflate(data)
end