📄 io::compress::gzip.3
字号:
If an \f(CW\*(C`ExtraField\*(C'\fR option is specified and it is a simple scalar,it must conform to the sub-field structure as defined in \s-1RFC\s0 1952..IP "\(bu" 5If an \f(CW\*(C`ExtraField\*(C'\fR option is specified the second byte of the \s-1ID\s0 will bechecked in each subfield to ensure that it does not contain the reservedvalue 0x00..RE.RS 5.SpWhen \f(CW\*(C`Strict\*(C'\fR is disabled the following behaviour will be policed:.IP "\(bu" 5The value supplied with \f(CW\*(C`\-Name\*(C'\fR option can containany character except \s-1NULL\s0..IP "\(bu" 5The value supplied with \f(CW\*(C`\-Comment\*(C'\fR option can contain any characterexcept \s-1NULL\s0..IP "\(bu" 5The values supplied with the \f(CW\*(C`\-Name\*(C'\fR and \f(CW\*(C`\-Comment\*(C'\fR options can containmultiple embedded nulls. The string written to the gzip header willconsist of the characters up to, but not including, the first embedded\&\s-1NULL\s0..IP "\(bu" 5If an \f(CW\*(C`ExtraField\*(C'\fR option is specified and it is a simple scalar, thestructure will not be checked. The only error is if the length is too big..IP "\(bu" 5The \s-1ID\s0 header in an \f(CW\*(C`ExtraField\*(C'\fR sub-field can consist of any two bytes..RE.RS 5.RE.Sh "Examples".IX Subsection "Examples"\&\s-1TODO\s0.SH "Methods".IX Header "Methods".Sh "print".IX Subsection "print"Usage is.PP.Vb 2\& $z\->print($data)\& print $z $data.Ve.PPCompresses and outputs the contents of the \f(CW$data\fR parameter. Thishas the same behaviour as the \f(CW\*(C`print\*(C'\fR built-in..PPReturns true if successful..Sh "printf".IX Subsection "printf"Usage is.PP.Vb 2\& $z\->printf($format, $data)\& printf $z $format, $data.Ve.PPCompresses and outputs the contents of the \f(CW$data\fR parameter..PPReturns true if successful..Sh "syswrite".IX Subsection "syswrite"Usage is.PP.Vb 3\& $z\->syswrite $data\& $z\->syswrite $data, $length\& $z\->syswrite $data, $length, $offset.Ve.PPCompresses and outputs the contents of the \f(CW$data\fR parameter..PPReturns the number of uncompressed bytes written, or \f(CW\*(C`undef\*(C'\fR ifunsuccessful..Sh "write".IX Subsection "write"Usage is.PP.Vb 3\& $z\->write $data\& $z\->write $data, $length\& $z\->write $data, $length, $offset.Ve.PPCompresses and outputs the contents of the \f(CW$data\fR parameter..PPReturns the number of uncompressed bytes written, or \f(CW\*(C`undef\*(C'\fR ifunsuccessful..Sh "flush".IX Subsection "flush"Usage is.PP.Vb 2\& $z\->flush;\& $z\->flush($flush_type);.Ve.PPFlushes any pending compressed data to the output file/buffer..PPThis method takes an optional parameter, \f(CW$flush_type\fR, that controlshow the flushing will be carried out. By default the \f(CW$flush_type\fRused is \f(CW\*(C`Z_FINISH\*(C'\fR. Other valid values for \f(CW$flush_type\fR are\&\f(CW\*(C`Z_NO_FLUSH\*(C'\fR, \f(CW\*(C`Z_SYNC_FLUSH\*(C'\fR, \f(CW\*(C`Z_FULL_FLUSH\*(C'\fR and \f(CW\*(C`Z_BLOCK\*(C'\fR. It isstrongly recommended that you only set the \f(CW\*(C`flush_type\*(C'\fR parameter ifyou fully understand the implications of what it does \- overuse of \f(CW\*(C`flush\*(C'\fRcan seriously degrade the level of compression achieved. See the \f(CW\*(C`zlib\*(C'\fRdocumentation for details..PPReturns true on success..Sh "tell".IX Subsection "tell"Usage is.PP.Vb 2\& $z\->tell()\& tell $z.Ve.PPReturns the uncompressed file offset..Sh "eof".IX Subsection "eof"Usage is.PP.Vb 2\& $z\->eof();\& eof($z);.Ve.PPReturns true if the \f(CW\*(C`close\*(C'\fR method has been called..Sh "seek".IX Subsection "seek".Vb 2\& $z\->seek($position, $whence);\& seek($z, $position, $whence);.Ve.PPProvides a sub-set of the \f(CW\*(C`seek\*(C'\fR functionality, with the restrictionthat it is only legal to seek forward in the output file/buffer.It is a fatal error to attempt to seek backward..PPEmpty parts of the file/buffer will have \s-1NULL\s0 (0x00) bytes written to them..PPThe \f(CW$whence\fR parameter takes one the usual values, namely \s-1SEEK_SET\s0,\&\s-1SEEK_CUR\s0 or \s-1SEEK_END\s0..PPReturns 1 on success, 0 on failure..Sh "binmode".IX Subsection "binmode"Usage is.PP.Vb 2\& $z\->binmode\& binmode $z ;.Ve.PPThis is a noop provided for completeness..Sh "opened".IX Subsection "opened".Vb 1\& $z\->opened().Ve.PPReturns true if the object currently refers to a opened file/buffer..Sh "autoflush".IX Subsection "autoflush".Vb 2\& my $prev = $z\->autoflush()\& my $prev = $z\->autoflush(EXPR).Ve.PPIf the \f(CW$z\fR object is associated with a file or a filehandle, this methodreturns the current autoflush setting for the underlying filehandle. If\&\f(CW\*(C`EXPR\*(C'\fR is present, and is non-zero, it will enable flushing after everywrite/print operation..PPIf \f(CW$z\fR is associated with a buffer, this method has no effect and alwaysreturns \f(CW\*(C`undef\*(C'\fR..PP\&\fBNote\fR that the special variable \f(CW$|\fR \fBcannot\fR be used to set orretrieve the autoflush setting..Sh "input_line_number".IX Subsection "input_line_number".Vb 2\& $z\->input_line_number()\& $z\->input_line_number(EXPR).Ve.PPThis method always returns \f(CW\*(C`undef\*(C'\fR when compressing..Sh "fileno".IX Subsection "fileno".Vb 2\& $z\->fileno()\& fileno($z).Ve.PPIf the \f(CW$z\fR object is associated with a file or a filehandle, this methodwill return the underlying file descriptor..PPIf the \f(CW$z\fR object is is associated with a buffer, this method willreturn undef..Sh "close".IX Subsection "close".Vb 2\& $z\->close() ;\& close $z ;.Ve.PPFlushes any pending compressed data and then closes the output file/buffer..PPFor most versions of Perl this method will be automatically invoked ifthe IO::Compress::Gzip object is destroyed (either explicitly or by thevariable with the reference to the object going out of scope). Theexceptions are Perl versions 5.005 through 5.00504 and 5.8.0. Inthese cases, the \f(CW\*(C`close\*(C'\fR method will be called automatically, butnot until global destruction of all live objects when the program isterminating..PPTherefore, if you want your scripts to be able to run on all versionsof Perl, you should call \f(CW\*(C`close\*(C'\fR explicitly and not rely on automaticclosing..PPReturns true on success, otherwise 0..PPIf the \f(CW\*(C`AutoClose\*(C'\fR option has been enabled when the IO::Compress::Gzipobject was created, and the object is associated with a file, theunderlying file will also be closed..Sh "newStream([\s-1OPTS\s0])".IX Subsection "newStream([OPTS])"Usage is.PP.Vb 1\& $z\->newStream( [OPTS] ).Ve.PPCloses the current compressed data stream and starts a new one..PP\&\s-1OPTS\s0 consists of any of the the options that are available when creatingthe \f(CW$z\fR object..PPSee the \*(L"Constructor Options\*(R" section for more details..Sh "deflateParams".IX Subsection "deflateParams"Usage is.PP.Vb 1\& $z\->deflateParams.Ve.PP\&\s-1TODO\s0.SH "Importing".IX Header "Importing"A number of symbolic constants are required by some methods in \&\f(CW\*(C`IO::Compress::Gzip\*(C'\fR. None are imported by default..IP ":all" 5.IX Item ":all"Imports \f(CW\*(C`gzip\*(C'\fR, \f(CW$GzipError\fR and all symbolicconstants that can be used by \f(CW\*(C`IO::Compress::Gzip\*(C'\fR. Same as doing this.Sp.Vb 1\& use IO::Compress::Gzip qw(gzip $GzipError :constants) ;.Ve.IP ":constants" 5.IX Item ":constants"Import all symbolic constants. Same as doing this.Sp.Vb 1\& use IO::Compress::Gzip qw(:flush :level :strategy) ;.Ve.IP ":flush" 5.IX Item ":flush"These symbolic constants are used by the \f(CW\*(C`flush\*(C'\fR method..Sp.Vb 6\& Z_NO_FLUSH\& Z_PARTIAL_FLUSH\& Z_SYNC_FLUSH\& Z_FULL_FLUSH\& Z_FINISH\& Z_BLOCK.Ve.IP ":level" 5.IX Item ":level"These symbolic constants are used by the \f(CW\*(C`Level\*(C'\fR option in the constructor..Sp.Vb 4\& Z_NO_COMPRESSION\& Z_BEST_SPEED\& Z_BEST_COMPRESSION\& Z_DEFAULT_COMPRESSION.Ve.IP ":strategy" 5.IX Item ":strategy"These symbolic constants are used by the \f(CW\*(C`Strategy\*(C'\fR option in the constructor..Sp.Vb 5\& Z_FILTERED\& Z_HUFFMAN_ONLY\& Z_RLE\& Z_FIXED\& Z_DEFAULT_STRATEGY.Ve.PPFor.SH "EXAMPLES".IX Header "EXAMPLES"\&\s-1TODO\s0.SH "SEE ALSO".IX Header "SEE ALSO"Compress::Zlib, IO::Uncompress::Gunzip, IO::Compress::Deflate, IO::Uncompress::Inflate, IO::Compress::RawDeflate, IO::Uncompress::RawInflate, IO::Compress::Bzip2, IO::Uncompress::Bunzip2, IO::Compress::Lzop, IO::Uncompress::UnLzop, IO::Compress::Lzf, IO::Uncompress::UnLzf, IO::Uncompress::AnyInflate, IO::Uncompress::AnyUncompress.PPCompress::Zlib::FAQ.PPFile::GlobMapper, Archive::Zip,Archive::Tar,IO::Zlib.PPFor \s-1RFC\s0 1950, 1951 and 1952 see \&\fIhttp://www.faqs.org/rfcs/rfc1950.html\fR,\&\fIhttp://www.faqs.org/rfcs/rfc1951.html\fR and\&\fIhttp://www.faqs.org/rfcs/rfc1952.html\fR.PPThe \fIzlib\fR compression library was written by Jean-loup Gailly\&\fIgzip@prep.ai.mit.edu\fR and Mark Adler \fImadler@alumni.caltech.edu\fR..PPThe primary site for the \fIzlib\fR compression library is\&\fIhttp://www.zlib.org\fR..PPThe primary site for gzip is \fIhttp://www.gzip.org\fR..SH "AUTHOR".IX Header "AUTHOR"This module was written by Paul Marquess, \fIpmqs@cpan.org\fR..SH "MODIFICATION HISTORY".IX Header "MODIFICATION HISTORY"See the Changes file..SH "COPYRIGHT AND LICENSE".IX Header "COPYRIGHT AND LICENSE"Copyright (c) 2005\-2007 Paul Marquess. All rights reserved..PPThis program is free software; you can redistribute it and/ormodify it under the same terms as Perl itself.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -