Class: Zip::ZipInputStream
Instance Attribute Summary
#lineno
Class Method Summary
collapse
Instance Method Summary
collapse
#each_line, #flush, #gets, #readline, #readlines
#kind_of?
Methods included from Enumerable
#deep_clone, #deep_dup, #inject, #select_map
Constructor Details
#initialize(filename, offset = 0) ⇒ ZipInputStream
Returns a new instance of ZipInputStream.
34
35
36
37
38
39
40
|
# File 'lib/zip/zip.rb', line 34
def initialize(filename, offset = 0)
super()
@archiveIO = File.open(filename, "rb")
@archiveIO.seek(offset, IO::SEEK_SET)
@decompressor = NullDecompressor.instance
@currentEntry = nil
end
|
Class Method Details
.open(filename) ⇒ Object
46
47
48
49
50
51
52
53
|
# File 'lib/zip/zip.rb', line 46
def ZipInputStream.open(filename)
return new(filename) unless block_given?
zio = new(filename)
yield zio
ensure
zio.close if zio
end
|
Instance Method Details
42
43
44
|
# File 'lib/zip/zip.rb', line 42
def close
@archiveIO.close
end
|
#get_next_entry ⇒ Object
55
56
57
58
59
|
# File 'lib/zip/zip.rb', line 55
def get_next_entry
@archiveIO.seek(@currentEntry.,
IO::SEEK_SET) if @currentEntry
open_entry
end
|
#read(numberOfBytes = nil) ⇒ Object
86
87
88
|
# File 'lib/zip/zip.rb', line 86
def read(numberOfBytes = nil)
@decompressor.read(numberOfBytes)
end
|
61
62
63
64
65
66
67
|
# File 'lib/zip/zip.rb', line 61
def rewind
return if @currentEntry.nil?
@lineno = 0
@archiveIO.seek(@currentEntry.,
IO::SEEK_SET)
open_entry
end
|