Class Zip::ZipOutputStream
In: lib/zip/zip.rb
Parent: Object

ZipOutputStream is the basic class for writing zip files. It is possible to create a ZipOutputStream object directly, passing the zip file name to the constructor, but more often than not the ZipOutputStream will be obtained from a ZipFile (perhaps using the ZipFileSystem interface) object for a particular entry in the zip archive.

A ZipOutputStream inherits IOExtras::AbstractOutputStream in order to provide an IO-like interface for writing to a single zip entry. Beyond methods for mimicking an IO-object it contains the method put_next_entry that closes the current entry and creates a new.

Please refer to ZipInputStream for example code.

java.util.zip.ZipOutputStream is the original inspiration for this class.

Methods

<<   close   copy_raw_entry   finish   new   open   put_next_entry  

Included Modules

IOExtras::AbstractOutputStream

Attributes

comment  [RW] 

Public Class methods

Opens the indicated zip file. If a file with that name already exists it will be overwritten.

Same as initialize but if a block is passed the opened stream is passed to the block and closed when the block returns.

Public Instance methods

Modeled after IO.<<

Closes the stream and writes the central directory to the zip file

Closes the current entry and opens a new for writing. entry can be a ZipEntry object or a string.

Protected Instance methods

[Validate]