Class: LZWS::Stream::Raw::Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/lzws/stream/raw/abstract.rb

Direct Known Subclasses

Compressor, Decompressor

Instance Method Summary collapse

Constructor Details

#initialize(native_stream) ⇒ Abstract

Returns a new instance of Abstract.



13
14
15
16
# File 'lib/lzws/stream/raw/abstract.rb', line 13

def initialize(native_stream)
  @native_stream = native_stream
  @is_closed     = false
end

Instance Method Details

#close(&writer) ⇒ Object



48
49
50
51
52
53
54
55
# File 'lib/lzws/stream/raw/abstract.rb', line 48

def close(&writer)
  write_result(&writer)

  @native_stream.close
  @is_closed = true

  nil
end

#closed?Boolean

Returns:

  • (Boolean)


57
58
59
# File 'lib/lzws/stream/raw/abstract.rb', line 57

def closed?
  @is_closed
end

#flush(&writer) ⇒ Object

– write –



20
21
22
23
24
25
26
27
28
# File 'lib/lzws/stream/raw/abstract.rb', line 20

def flush(&writer)
  do_not_use_after_close

  Validation.validate_proc writer

  write_result(&writer)

  nil
end