Class: XZ::Stream

Inherits:
Object
  • Object
show all
Includes:
IO::Like
Defined in:
lib/xz/stream.rb

Overview

The base class for XZ::StreamReader and XZ::StreamWriter. This is an abstract class that is not meant to be used directly; if you try, you will soon recognise that you’ve created a quite limited object ;-). You can, however, test against this class in kind_of? tests.

XZ::StreamReader and XZ::StreamWriter are IO-like classes that allow you to access XZ-compressed data the same way you access an IO-object, easily allowing to fool other libraries that expect IO objects. The most noticable example for this may be reading and writing XZ-compressed tarballs; see XZ::StreamReader and XZ::StreamWriter for respective examples.

Neither this class nor its subclasses document the IO-methods they contain–this is due to the reason that they include the great IO::Like module that provides all the necessary IO methods based on a few methods you define. For all defined IO methods, see the io-like gem’s documentation.

Direct Known Subclasses

StreamReader, StreamWriter

Instance Method Summary collapse

Constructor Details

#initialize(delegate_io) ⇒ Stream

Creates a new instance of this class. Don’t use this directly, it’s only called by subclasses’ ::new methods.



51
52
53
54
# File 'lib/xz/stream.rb', line 51

def initialize(delegate_io)
  @delegate_io    = delegate_io
  @lzma_stream    = XZ::LZMAStream.new
end