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.



1043
1044
1045
1046
1047
1048
# File 'lib/zip/zip.rb', line 1043

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

Instance Attribute Details

#crcObject (readonly)

Returns the value of attribute crc.



1057
1058
1059
# File 'lib/zip/zip.rb', line 1057

def crc
  @crc
end

#sizeObject (readonly)

Returns the value of attribute size.



1057
1058
1059
# File 'lib/zip/zip.rb', line 1057

def size
  @size
end

Instance Method Details

#<<(data) ⇒ Object



1050
1051
1052
1053
1054
1055
# File 'lib/zip/zip.rb', line 1050

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