Sha256: e4fdcc3cf8e8035f6dfb50a0be0a35fc3ae885aef9bae243e583a2c62112cb8f
Contents?: true
Size: 1.16 KB
Versions: 16
Compression:
Stored size: 1.16 KB
Contents
module Zip class PassThruDecompressor < Decompressor #:nodoc:all def initialize(inputStream, charsToRead) super inputStream @charsToRead = charsToRead @readSoFar = 0 @hasReturnedEmptyString = ! EMPTY_FILE_RETURNS_EMPTY_STRING_FIRST end # TODO: Specialize to handle different behaviour in ruby > 1.7.0 ? def sysread(numberOfBytes = nil, buf = nil) if input_finished? hasReturnedEmptyStringVal = @hasReturnedEmptyString @hasReturnedEmptyString = true return "" unless hasReturnedEmptyStringVal return end if (numberOfBytes == nil || @readSoFar + numberOfBytes > @charsToRead) numberOfBytes = @charsToRead - @readSoFar end @readSoFar += numberOfBytes @inputStream.read(numberOfBytes, buf) end def produce_input sysread(Decompressor::CHUNK_SIZE) end def input_finished? (@readSoFar >= @charsToRead) end alias :eof :input_finished? alias :eof? :input_finished? end end # Copyright (C) 2002, 2003 Thomas Sondergaard # rubyzip is free software; you can redistribute it and/or # modify it under the terms of the ruby license.
Version data entries
16 entries across 16 versions & 3 rubygems