Sha256: ef2f78e7b56c8b002a7b70326bf89bf98bcc00c49eeb6185d0e1a2f459d8f698
Contents?: true
Size: 917 Bytes
Versions: 11
Compression:
Stored size: 917 Bytes
Contents
# encoding: UTF-8 module Yajl module Bzip2 # This is a wrapper around Bzip::Reader to allow it's #read method to adhere # to the IO spec, allowing for two parameters (length, and buffer) class StreamReader < ::Bzip2::Reader # A helper method to allow use similar to IO#read def read(len=nil, buffer=nil) if val = super(len) unless buffer.nil? buffer.replace(val) return buffer end super(len) else nil end end # Helper method for one-off parsing from a bzip2-compressed stream # # See Yajl::Parser#parse for parameter documentation def self.parse(input, options={}, buffer_size=nil, &block) if input.is_a?(String) input = StringIO.new(input) end Yajl::Parser.new(options).parse(new(input), buffer_size, &block) end end end end
Version data entries
11 entries across 11 versions & 2 rubygems