Class: Zlib::GzipFile
Relationships & Source Files | |
Namespace Children | |
Exceptions:
| |
Extension / Inclusion / Inheritance Descendants | |
Subclasses:
|
|
Inherits: | Object |
Defined in: | ext/zlib/zlib.c, ext/zlib/zlib.c |
Overview
GzipFile
is an abstract class for handling a gzip formatted compressed file. The operations are defined in the subclasses, GzipReader for reading, and GzipWriter for writing.
GzipReader should be used by associating an IO, or IO-like, object.
Method Catalogue
-
.open
(Zlib::GzipReader::open and GzipWriter.open) -
comment= (Zlib::GzipWriter#comment=)
-
eof? (Zlib::GzipReader#eof?)
-
lineno (Zlib::GzipReader#lineno)
-
lineno= (Zlib::GzipReader#lineno=)
-
mtime= (Zlib::GzipWriter#mtime=)
-
orig_name (Zlib::GzipWriter#orig_name=)
-
path (when the underlying IO supports
#path
)
(due to internal structure, documentation may appear under GzipReader or GzipWriter)
Class Method Summary
-
Zlib::GzipReader.wrap(io, ...) {|gz| ... }
Creates a GzipReader or GzipWriter associated with
io
, passing in any necessary extra options, and executes the block with the newly created object just likeFile.open
.
Instance Attribute Summary
-
#sync
rw
Same as
IO#sync
-
#sync=(flag)
rw
Same as IO.
-
#closed? ⇒ Boolean
readonly
Same as
IO#closed?
Instance Method Summary
-
#close
Closes the
GzipFile
object. -
#comment
Returns comments recorded in the gzip file header, or nil if the comments is not present.
-
#crc
Returns CRC value of the uncompressed data.
-
#finish
Closes the
GzipFile
object. -
#level
Returns compression level.
-
#mtime
Returns last modification time recorded in the gzip file header.
-
#orig_name
Returns original filename recorded in the gzip file header, or
nil
if original filename is not present. -
#os_code
Returns OS code number recorded in the gzip file header.
-
#to_io
Same as IO.
Class Method Details
Zlib::GzipReader.wrap(io, ...) {|gz| ... }
Zlib::GzipWriter.wrap(io, ...) {|gz| ... }
Creates a GzipReader or GzipWriter associated with io
, passing in any necessary extra options, and executes the block with the newly created object just like File.open
.
The GzipFile object will be closed automatically after executing the block. If you want to keep the associated IO object open, you may call #finish method in the block.
Instance Attribute Details
#closed? ⇒ Boolean
(readonly)
Same as IO#closed?
#sync (rw)
Same as IO#sync
#sync=(flag) (rw)
Same as IO. If flag is true
, the associated IO object must respond to the flush
method. While #sync mode is true
, the compression ratio decreases sharply.
Instance Method Details
#close
Closes the GzipFile
object. This method calls close method of the associated IO object. Returns the associated IO object.
#comment
Returns comments recorded in the gzip file header, or nil if the comments is not present.
#crc
Returns CRC value of the uncompressed data.
#finish
Closes the GzipFile
object. Unlike #close, this method never calls the close method of the associated IO object. Returns the associated IO object.
#level
Returns compression level.
#mtime
Returns last modification time recorded in the gzip file header.
#orig_name
Returns original filename recorded in the gzip file header, or nil
if original filename is not present.
#os_code
Returns OS code number recorded in the gzip file header.
#to_io
Same as IO.