class Compress::Brotli::Reader

Overview

string = File.open("file.br") do |file| Compress::Brotli::Reader.open(file) do |br|

 br.gets_to_end

end end pp string

Included Modules

Defined in:

Constant Summary

BUF_SIZE = 4096

buffer size that avoids execessive round-trips between C and Crystal but doesn't waste too much memory on buffering. Its arbitrarily chosen to be equal to the constant used in IO::copy

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(io : IO, sync_close : Bool = false) #

Creates an instance of XZ::Reader.


def self.new(filename : String) #

Creates a new reader from the given filename.


Class Method Detail

def self.open(io : IO, sync_close : Bool = false, &) #

Creates a new reader from the given io, yields it to the given block, and closes it at its end.


def self.open(io : IO, sync_close = false, &) #

Creates a new reader from the given io, yields it to the given block, and closes it at the end.


def self.open(filename : String, &) #

Creates a new reader from the given filename, yields it to the given block, and closes it at the end.


Instance Method Detail

def closed? : Bool #

Returns true if this reader is closed.


def sync_close=(sync_close : Bool) #

If #sync_close? is true, closing this IO will close the underlying IO.


def sync_close? : Bool #

If #sync_close? is true, closing this IO will close the underlying IO.


def unbuffered_close #

Closes this reader.


def unbuffered_flush #
Description copied from module IO::Buffered

Flushes the wrapped IO.


def unbuffered_read(slice : Bytes) #
Description copied from module IO::Buffered

Reads at most slice.size bytes from the wrapped IO into slice. Returns the number of bytes read.


def unbuffered_rewind #
Description copied from module IO::Buffered

Rewinds the wrapped IO.


def unbuffered_write(slice : Bytes) #

Always raises IO::Error because this is a read-only IO.