Sha256: e4892bb0abc213d8014dc7252ed87791b14f3a4ec6fd7afbc4d35fb51b7c32ed

Contents?: true

Size: 899 Bytes

Versions: 26

Compression:

Stored size: 899 Bytes

Contents

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

26 entries across 26 versions & 9 rubygems

Version Path
fluent-plugin-nuopenlineage-light-0.1.0 vendor/bundle/ruby/3.3.0/gems/yajl-ruby-1.4.3/lib/yajl/bzip2/stream_reader.rb
fluent-plugin-openlineage-light-0.1.4 vendor/bundle/ruby/3.3.0/gems/yajl-ruby-1.4.3/lib/yajl/bzip2/stream_reader.rb
fluent-plugin-openlineage-light-0.1.3 vendor/bundle/ruby/3.3.0/gems/yajl-ruby-1.4.3/lib/yajl/bzip2/stream_reader.rb
fluent-plugin-openlineage-0.1.0 vendor/bundle/ruby/3.3.0/gems/yajl-ruby-1.4.3/lib/yajl/bzip2/stream_reader.rb
fluent-plugin-google-cloud-logging-on-prem-0.1.0 vendor/ruby/3.1.0/gems/yajl-ruby-1.4.3/lib/yajl/bzip2/stream_reader.rb
yajl-ruby-1.4.3 lib/yajl/bzip2/stream_reader.rb
yajl-ruby-1.4.2 lib/yajl/bzip2/stream_reader.rb
yajl-ruby-1.4.1 lib/yajl/bzip2/stream_reader.rb
yajl-ruby-1.4.0 lib/yajl/bzip2/stream_reader.rb
yajl-ruby-1.2.3 lib/yajl/bzip2/stream_reader.rb
yajl-ruby-1.3.1 lib/yajl/bzip2/stream_reader.rb
fluent-plugin-detect-memb-exceptions-0.0.2 vendor/bundle/ruby/2.0.0/gems/yajl-ruby-1.3.0/lib/yajl/bzip2/stream_reader.rb
fluent-plugin-detect-memb-exceptions-0.0.1 vendor/bundle/ruby/2.0.0/gems/yajl-ruby-1.3.0/lib/yajl/bzip2/stream_reader.rb
yajl-ruby-1.2.2 lib/yajl/bzip2/stream_reader.rb
yajl-ruby-1.3.0 lib/yajl/bzip2/stream_reader.rb
tdiary-4.2.1 vendor/bundle/ruby/2.2.0/gems/yajl-ruby-1.2.1/lib/yajl/bzip2/stream_reader.rb
yajl-ruby-1.2.1 lib/yajl/bzip2/stream_reader.rb
yajl-ruby-1.2.0 lib/yajl/bzip2/stream_reader.rb
yajl-ruby-zenjoy-1.1.0 lib/yajl/bzip2/stream_reader.rb
yajl-ruby-maglev--1.1.0 lib/yajl/bzip2/stream_reader.rb