Module: Snappy::Hadoop

Defined in:
lib/snappy/hadoop.rb,
lib/snappy/hadoop/reader.rb,
lib/snappy/hadoop/writer.rb

Defined Under Namespace

Classes: Reader, Writer

Class Method Summary collapse

Class Method Details

.deflate(source, block_size = Snappy::Hadoop::Writer::DEFAULT_BLOCK_SIZE) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/snappy/hadoop.rb', line 10

def self.deflate(source, block_size = Snappy::Hadoop::Writer::DEFAULT_BLOCK_SIZE)
  compressed_io = StringIO.new
  writer = Snappy::Hadoop::Writer.new(compressed_io)
  writer << source
  writer.flush
  compressed_io.string
end

.inflate(source) ⇒ Object



18
19
20
# File 'lib/snappy/hadoop.rb', line 18

def self.inflate(source)
  Snappy::Hadoop::Reader.new(StringIO.new(source)).read
end