Class: Zip::PassThruCompressor

Inherits:
Compressor show all
Defined in:
lib/ruby_archive/handlers/rubyzip/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.



1073
1074
1075
1076
1077
1078
# File 'lib/ruby_archive/handlers/rubyzip/zip/zip.rb', line 1073

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

Instance Attribute Details

#crcObject (readonly)

Returns the value of attribute crc.



1087
1088
1089
# File 'lib/ruby_archive/handlers/rubyzip/zip/zip.rb', line 1087

def crc
  @crc
end

#sizeObject (readonly)

Returns the value of attribute size.



1087
1088
1089
# File 'lib/ruby_archive/handlers/rubyzip/zip/zip.rb', line 1087

def size
  @size
end

Instance Method Details

#<<(data) ⇒ Object



1080
1081
1082
1083
1084
1085
# File 'lib/ruby_archive/handlers/rubyzip/zip/zip.rb', line 1080

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