*** empty log message ***

This commit is contained in:
thomas 2005-08-06 09:12:07 +00:00
parent b14651ce64
commit f51a2c6b46
2 changed files with 12 additions and 10 deletions

View File

@ -1,5 +1,13 @@
module IOExtras #:nodoc:
CHUNK_SIZE = 32768
def copy_stream(ostream, istream)
s = ''
ostream.write(istream.read(CHUNK_SIZE, s)) until istream.eof?
end
# Implements kind_of? in order to pretend to be an IO object
module FakeIO
def kind_of?(object)

View File

@ -19,12 +19,12 @@ end
module Zip
CHUNK_SIZE=32768
VERSION = '0.5.8'
RUBY_MINOR_VERSION = RUBY_VERSION.split(".")[1].to_i
CHUNK_SIZE=32768
# Ruby 1.7.x compatibility
# In ruby 1.6.x and 1.8.0 reading from an empty stream returns
# an empty string the first time and then nil.
@ -1279,10 +1279,7 @@ module Zip
def write_to_zip_output_stream(aZipOutputStream)
aZipOutputStream.put_next_entry(self)
get_input_stream {
|is|
aZipOutputStream.write(is.read(CHUNK_SIZE)) until is.eof?
}
get_input_stream { |is| copy_stream(aZipOutputStream, is) }
end
def == (other)
@ -1346,10 +1343,7 @@ module Zip
def write_to_zip_output_stream(aZipOutputStream)
aZipOutputStream.put_next_entry(self)
get_input_stream {
|is|
aZipOutputStream.write(is.read(CHUNK_SIZE)) until is.eof?
}
get_input_stream { |is| copy_stream(aZipOutputStream, is) }
end
end