Ruby 1.8.7 リファレンスマニュアル > ライブラリ一覧 > zlibライブラリ > Zlib::GzipWriterクラス
クラスの継承リスト: Zlib::GzipWriter < Zlib::GzipFile < Object < Kernel
gzip 形式の圧縮ファイルを書き出すラッパークラスです。 IO クラスのインスタンス (又は IO クラスのインスタンスと同じメソッドを 持つオブジェクト) と関連付けて使用します。
Zlib::GzipWriter.open('hoge.gz') {|gz| gz.write 'jugemu jugemu gokou no surikire...' } f = File.open('hoge.gz', 'w') gz = Zlib::GzipWriter.new(f) gz.write 'jugemu jugemu gokou no surikire...' gz.close
なお、Ruby の finalizer の制約のため、GzipWriter オブジェクトは必ず Zlib::GzipWriter#close 等を用いてクローズしてください。 そうしなければフッターを書き出すことができず、壊れた gzip ファイルを 生成してしまう可能性があります。
定義 | 説明 | |
---|---|---|
self << str -> self
|
str を出力します。str が文字列でない場合は to_s を用いて 文字列に変換します。 |
|
close -> File
|
フッターを書き出し、GzipWriter オブジェクトをクローズします。close と finish の違いは Zlib::GzipFile#close, Zlib::GzipFile#finish を 参照して下さい。 |
|
comment=(string)
|
gzip ファイルのヘッダーに記録するコメントを指定します。 |
|
flush(flush = Zlib::SYNC_FLUSH) -> self
|
まだ書き出されていないデータをフラッシュします。 |
|
mtime=(time)
|
gzip ファイルのヘッダーに記録する最終更新時間を指定します。 |
|
orig_name=(filename)
|
gzip ファイルのヘッダーに記録する元ファイル名を指定します。 |
|
pos -> Fixnum
|
現在までに圧縮したデータの長さの合計を返します。 ファイルポインタの位置ではないことに注意して下さい。 |
|
print(*str) -> nil
|
引数を自身に順に出力します。引数を省略した場合は、$_ を出力します。 |
|
printf(format, *args) -> nil
|
C 言語の printf と同じように、format に従い引数 を文字列に変換して、自身に出力します。 |
|
putc(ch) -> object
|
文字 ch を自身に出力します。 |
|
puts(*str) -> nil
|
各引数を自身に出力し、それぞれの後に改行を出力します。 |
|
write(str) -> Integer
|
自身に str を出力します。str が文字列でなけ れば to_s による文字列化を試みます。 |
==
===
=~
__id__
__send__
_dump
class
clone
dclone
display
enum_for
eql?
equal?
extend
freeze
frozen?
hash
initialize
initialize_copy
inspect
instance_eval
instance_exec
instance_of?
instance_variable_defined?
instance_variable_get
instance_variable_set
instance_variables
is_a?
marshal_dump
marshal_load
method
method_missing
methods
nil?
pretty_inspect
pretty_print
pretty_print_cycle
pretty_print_inspect
pretty_print_instance_variables
private_methods
protected_methods
public_methods
remove_instance_variable
respond_to?
singleton_method_added
singleton_method_removed
singleton_method_undefined
singleton_methods
taint
tainted?
tap
to_a
to_ary
to_hash
to_int
to_proc
to_regexp
to_s
to_str
to_yaml
to_yaml_properties
to_yaml_style
untaint
closed?
comment
crc
level
mtime
orig_name
os_code
sync