Sha256: 298d4294f01b7ee3105973680519d416f65bd08dd4cae35e706823e6b8ca9a04

Contents?: true

Size: 861 Bytes

Versions: 36

Compression:

Stored size: 861 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)
        unless buffer.nil?
          buffer.replace super(len)
          return buffer
        end
        super(len)
      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

36 entries across 36 versions & 5 rubygems

Version Path
brianmario-yajl-ruby-0.5.10 lib/yajl/bzip2/stream_reader.rb
brianmario-yajl-ruby-0.5.11 lib/yajl/bzip2/stream_reader.rb
brianmario-yajl-ruby-0.5.12 lib/yajl/bzip2/stream_reader.rb
brianmario-yajl-ruby-0.5.3 lib/yajl/bzip2/stream_reader.rb
brianmario-yajl-ruby-0.5.4 lib/yajl/bzip2/stream_reader.rb
brianmario-yajl-ruby-0.5.5 lib/yajl/bzip2/stream_reader.rb
brianmario-yajl-ruby-0.5.6 lib/yajl/bzip2/stream_reader.rb
brianmario-yajl-ruby-0.5.7 lib/yajl/bzip2/stream_reader.rb
brianmario-yajl-ruby-0.5.8 lib/yajl/bzip2/stream_reader.rb
brianmario-yajl-ruby-0.5.9 lib/yajl/bzip2/stream_reader.rb
brianmario-yajl-ruby-0.6.0 lib/yajl/bzip2/stream_reader.rb
brianmario-yajl-ruby-0.6.1 lib/yajl/bzip2/stream_reader.rb
brianmario-yajl-ruby-0.6.3 lib/yajl/bzip2/stream_reader.rb
jdg-yajl-ruby-0.5.12 lib/yajl/bzip2/stream_reader.rb
oortle-yajl-ruby-0.5.8 lib/yajl/bzip2/stream_reader.rb
yajl-ruby-0.7.1 lib/yajl/bzip2/stream_reader.rb
yajl-ruby-0.7.0 lib/yajl/bzip2/stream_reader.rb
yajl-ruby-0.6.9 lib/yajl/bzip2/stream_reader.rb
yajl-ruby-0.6.8 lib/yajl/bzip2/stream_reader.rb
yajl-ruby-0.6.7 lib/yajl/bzip2/stream_reader.rb