Class: Zip::PassThruCompressor

Inherits:
Compressor show all
Defined in:
lib/zip/zip.rb

Overview

:nodoc:all

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Compressor

#finish

Constructor Details

#initialize(outputStream) ⇒ PassThruCompressor

Returns a new instance of PassThruCompressor.



713
714
715
716
717
718
# File 'lib/zip/zip.rb', line 713

def initialize(outputStream)
  super()
  @outputStream = outputStream
  @crc = Zlib::crc32
  @size = 0
end

Instance Attribute Details

#crcObject (readonly)

Returns the value of attribute crc.



727
728
729
# File 'lib/zip/zip.rb', line 727

def crc
  @crc
end

#sizeObject (readonly)

Returns the value of attribute size.



727
728
729
# File 'lib/zip/zip.rb', line 727

def size
  @size
end

Instance Method Details

#<<(data) ⇒ Object



720
721
722
723
724
725
# File 'lib/zip/zip.rb', line 720

def << (data)
  val = data.to_s
  @crc = Zlib::crc32(val, @crc)
  @size += val.size
  @outputStream << val
end