=encoding euc-jp =head1 NAME =begin original PerlIO::gzip - Perl extension to provide a PerlIO layer to gzip/gunzip =end original PerlIO::gzip - PerlIOレイヤーをgzip/gunzipに提供するPerl拡張 =head1 SYNOPSIS use PerlIO::gzip; open FOO, "<:gzip", "file.gz" or die $!; print while ; # そしてそれは解凍されるでしょう... binmode FOO, ":gzip(none)" # ここから圧縮されたストリームを読み始める =head1 DESCRIPTION =begin original PerlIO::gzip provides a PerlIO layer that manipulates files in the format used by the C program. Compression and Decompression are implemented, but not together. If you attempt to open a file for reading and writing the open will fail. =end original PerlIO::gzipはCプログラムで使用される形式でファイルを操作するPerlIOレイヤーを提供します. 圧縮と解凍が実装されますが一緒に実装されるというわけではありません. =head1 EXPORT =begin original PerlIO::gzip exports no subroutines or symbols, just a perl layer C =end original PerlIO::gzipはどんなサブルーチンもシンボルもこのperlレイヤーCですらexportしません =head1 LAYER ARGUMENTS =begin original The C layer takes a comma separated list of arguments. 4 exclusive options choose the header checking mode: =end original Cレイヤーはカンマでくぎられたリストの引数を取得します. 4つの排他的なオプションはモードをチェックするヘッダーを選択します. =over 4 =item gzip =begin original The default. Expects a standard gzip file header for reading, writes a standard gzip file header. =end original デフォルトです. 読み込む為の標準のgzipファイルヘッダーを予想し,標準gzipファイルヘッダに書き込みます. =item none =begin original Expects or writes no file header; assumes the file handle is immediately a deflate stream (eg as would be found inside a C file) =end original どのようなヘッダファイルでも予想または書き込みをしません;ファイルハンドルは即座に 圧縮されたストリームと仮定します(例えば zipファイルで見つけられるように) =item auto =begin original Potentially dangerous. If the first two bytes match the C header "\x1f\x8b" then a gzip header is assumed (and checked) else a deflate stream is assumed. No different from gzip on writing. =end original 潜在的に危険を含んでいます.最初の2バイトがgzipヘッダ"\x1f\x8b"に一致するならば gzipヘッダと想定され(チェックされ)その他に圧縮されたストリームが想定される. gzipでの書き込みと異なりません. =item autopop =begin original Potentially dangerous. If the first two bytes match the C header "\x1f\x8b" then a gzip header is assumed (and checked) else the layer is silently popped. This results in gzip files being transparently decompressed, other files being treated normally. Of course, this has sides effects such as File::Copy becoming gunzip, and File::Compare comparing the uncompressed contents of files. =end original 潜在的に危険を含んでいます.最初の2バイトがgzipヘッダ"\x1f\x8b"に一致するならば gzipヘッダと想定され(チェックされ)その他にレイヤーは黙って取り出されます. 他のファイルが通常扱われるように結果としてgzipファイルは透過的に圧縮される. もちろん,これはgunzipにふさわしいFile::Copyのようにまた, ファイルの解凍されたコンテンツを比較するFile::Compareでは副作用を起こします. =begin original In autopop mode Opening a handle for writing (or reading and writing) will cause the gzip layer to automatically be popped. =end original autopopモードで書き込みハンドルをオープンする(または読込と書き込みで)のは gzipレイヤーを自動的に取り出すでしょう. =back =begin original Optionally you can add this flag: =end original 任意でこのフラグを追加することができます: =over 4 =item lazy =begin original For reading, defer header checking until the first read. For writing, don't write a header until the first buffer empty of compressed data to disk. (and don't write anything at all if no data was written to the handle) =end original 読み込むには,始めの読込までヘッダをチェックするのを延期してください。 書き込むには,ディスクに圧縮されたデータを最初のバッファまで,ヘッダを書き込まないで下さい (そしてデータが全くハンドルに書かれなかったなら何も書き込まないで下さい) =begin original By default, gzip header checking is done before the C (or C) returns, so if an error is detected in the gzip header the C or C will fail. However, this will require reading some data, or writing a header. With lazy set on a file opened for reading the check is deferred until the first read so the C should always succeed, but any problems with the header will cause an error on read. =end original デフォルトで,gzipヘッダのチェックはC (または C)の前に実施され返される, したがって誤りがgzipヘッダに検出されるとCまたはCは失敗するでしょう. しかしながら,これはいくらかのデータを読み込むまたは書き込むことを必要とするでしょう. 読み込む為に開かれたファイル上に怠惰な設定がある状態で,始めの読込のチェックが延期されるので, Cはいつでも成功するべきです,しかし,ヘッダーに関するどんな問題も読込の時にエラーを引き起こすでしょう. open FOO, "<:gzip(lazy)", "file.gz" or die $!; # 危険. while () { print; } # ワオ.駄目ですね. あなたはエラーとEOFを見分けていません. =begin original If you're not careful you won't spot the errors - like the example above you'll think you got end of file. =end original 慎重で無いのならば上の例でファイルの終わりを見つけたと思ったようにあなたはエラーを見つけないでしょう =begin original lazy is ignored if you are in autopop mode. =end original autopopモードであれば怠惰は無視される. =back =head1 AUTHOR Nicholas Clark, Enick@talking.bollo.cxE =head1 SEE ALSO L, L, L (the gzip file format specification), L (DEFLATE compressed data format specification) =head1 翻訳者 atsushi kobayashi(nekokak@users.sourceforge.jp)