Update rdoc of zlib.
Add description about gzip(1) compatible output. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30396 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
d298593f56
commit
e755ecacf9
@ -2852,7 +2852,7 @@ rb_gzfile_ecopts(struct gzfile *gz, VALUE opts)
|
|||||||
* Zlib::GzipWriter is a class for writing gzipped files. GzipWriter should
|
* Zlib::GzipWriter is a class for writing gzipped files. GzipWriter should
|
||||||
* be used with an instance of IO, or IO-like, object.
|
* be used with an instance of IO, or IO-like, object.
|
||||||
*
|
*
|
||||||
* For example:
|
* Following two example generate the same result.
|
||||||
*
|
*
|
||||||
* Zlib::GzipWriter.open('hoge.gz') do |gz|
|
* Zlib::GzipWriter.open('hoge.gz') do |gz|
|
||||||
* gz.write 'jugemu jugemu gokou no surikire...'
|
* gz.write 'jugemu jugemu gokou no surikire...'
|
||||||
@ -2864,8 +2864,14 @@ rb_gzfile_ecopts(struct gzfile *gz, VALUE opts)
|
|||||||
* gz.close
|
* gz.close
|
||||||
* end
|
* end
|
||||||
*
|
*
|
||||||
* # TODO: test these. Are they equivalent? Can GzipWriter.new take a
|
* To make like gzip(1) does, run following:
|
||||||
* # block?
|
*
|
||||||
|
* orig = 'hoge.txt'
|
||||||
|
* Zlib::GzipWriter.open('hoge.gz') do |gz|
|
||||||
|
* gz.mtime = File.mtime(orig)
|
||||||
|
* gz.orig_name = orig
|
||||||
|
* gz.write IO.binread(orig)
|
||||||
|
* end
|
||||||
*
|
*
|
||||||
* NOTE: Due to the limitation of Ruby's finalizer, you must explicitly close
|
* NOTE: Due to the limitation of Ruby's finalizer, you must explicitly close
|
||||||
* GzipWriter objects by Zlib::GzipWriter#close etc. Otherwise, GzipWriter
|
* GzipWriter objects by Zlib::GzipWriter#close etc. Otherwise, GzipWriter
|
||||||
|
Loading…
x
Reference in New Issue
Block a user