Sha256: dd69a797eccea19cbd2c42d3ea9b6f9a935bb65fe10662453ced0a620159b0dc

Contents?: true

Size: 382 Bytes

Versions: 4

Compression:

Stored size: 382 Bytes

Contents

module Zstd
  # @todo Exprimental
  class StreamReader
    def initialize(io)
      @io = io
      @stream = Zstd::StreamingDecompress.new
    end

    def read(length)
      if @io.eof?
        raise StandardError, "EOF"
      end
      data = @io.read(length)
      @stream.decompress(data)
    end

    def close
      @io.write(@stream.finish)
      @io.close
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
zstd-ruby-1.5.6.5 lib/zstd-ruby/stream_reader.rb
zstd-ruby-1.5.6.4 lib/zstd-ruby/stream_reader.rb
zstd-ruby-1.5.6.3 lib/zstd-ruby/stream_reader.rb
zstd-ruby-1.5.6.2 lib/zstd-ruby/stream_reader.rb