### Home Classes Methods

### In Files

- lib/yajl/bzip2/stream_reader.rb

### Parent

Bzip2::Reader

### Methods

- ::parse
- #read

### Class/Module Index

Quicksearch

- Yajl
- Yajl::Bzip2
- Yajl::Bzip2::StreamReader
- Yajl::Bzip2::StreamWriter
- Yajl::Deflate
- Yajl::Deflate::StreamReader
- Yajl::Deflate::StreamWriter
- Yajl::Encoder
- Yajl::Gzip
- Yajl::Gzip::StreamReader
- Yajl::Gzip::StreamWriter
- Yajl::HttpStream
- Yajl::HttpStream::HttpError
- Yajl::HttpStream::InvalidContentType
- Yajl::Parser
- JSON
- JSON::GeneratorError
- JSON::JSONError
- JSON::ParserError
- Kernel
- Object

No matching classes.

# Yajl::Bzip2::StreamReader

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)

### Public Class Methods

parse(input, options={}, buffer_size=nil, &block) click to toggle source

Helper method for one-off parsing from a bzip2-compressed stream

See Yajl::Parser#parse for parameter documentation

    # File lib/yajl/bzip2/stream_reader.rb, line 22
    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

### Public Instance Methods

read(len=nil, buffer=nil) click to toggle source

A helper method to allow use similar to IO#read

    # File lib/yajl/bzip2/stream_reader.rb, line 7
    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

[Validate]

Generated with the Darkfish Rdoc Generator 2.