📄 io::compress::rawdeflate.3
字号:
.PPIf the \f(CW$output\fR parameter is any other type, \f(CW\*(C`IO::Compress::RawDeflate\*(C'\fR::new willreturn undef..Sh "Constructor Options".IX Subsection "Constructor Options"\&\f(CW\*(C`OPTS\*(C'\fR is any combination of the following options:.ie n .IP """AutoClose => 0|1""" 5.el .IP "\f(CWAutoClose => 0|1\fR" 5.IX Item "AutoClose => 0|1"This option is only valid when the \f(CW$output\fR parameter is a filehandle. Ifspecified, and the value is true, it will result in the \f(CW$output\fR beingclosed once either the \f(CW\*(C`close\*(C'\fR method is called or the \f(CW\*(C`IO::Compress::RawDeflate\*(C'\fRobject is destroyed..SpThis parameter defaults to 0..ie n .IP """Append => 0|1""" 5.el .IP "\f(CWAppend => 0|1\fR" 5.IX Item "Append => 0|1"Opens \f(CW$output\fR in append mode..SpThe behaviour of this option is dependent on the type of \f(CW$output\fR..RS 5.IP "\(bu" 5A Buffer.SpIf \f(CW$output\fR is a buffer and \f(CW\*(C`Append\*(C'\fR is enabled, all compressed datawill be append to the end if \f(CW$output\fR. Otherwise \f(CW$output\fR will becleared before any data is written to it..IP "\(bu" 5A Filename.SpIf \f(CW$output\fR is a filename and \f(CW\*(C`Append\*(C'\fR is enabled, the file will beopened in append mode. Otherwise the contents of the file, if any, will betruncated before any compressed data is written to it..IP "\(bu" 5A Filehandle.SpIf \f(CW$output\fR is a filehandle, the file pointer will be positioned to theend of the file via a call to \f(CW\*(C`seek\*(C'\fR before any compressed data is writtento it. Otherwise the file pointer will not be moved..RE.RS 5.SpThis parameter defaults to 0..RE.ie n .IP """Merge => 0|1""" 5.el .IP "\f(CWMerge => 0|1\fR" 5.IX Item "Merge => 0|1"This option is used to compress input data and append it to an existingcompressed data stream in \f(CW$output\fR. The end result is a single compresseddata stream stored in \f(CW$output\fR..SpIt is a fatal error to attempt to use this option when \f(CW$output\fR is not an\&\s-1RFC\s0 1951 data stream..SpThere are a number of other limitations with the \f(CW\*(C`Merge\*(C'\fR option:.RS 5.IP "1." 5This module needs to have been built with zlib 1.2.1 or better to work. Afatal error will be thrown if \f(CW\*(C`Merge\*(C'\fR is used with an older version ofzlib..IP "2." 5If \f(CW$output\fR is a file or a filehandle, it must be seekable..RE.RS 5.SpThis parameter defaults to 0..RE.IP "\-Level" 5.IX Item "-Level"Defines the compression level used by zlib. The value should either bea number between 0 and 9 (0 means no compression and 9 is maximumcompression), or one of the symbolic constants defined below..Sp.Vb 4\& Z_NO_COMPRESSION\& Z_BEST_SPEED\& Z_BEST_COMPRESSION\& Z_DEFAULT_COMPRESSION.Ve.SpThe default is Z_DEFAULT_COMPRESSION..SpNote, these constants are not imported by \f(CW\*(C`IO::Compress::RawDeflate\*(C'\fR by default..Sp.Vb 3\& use IO::Compress::RawDeflate qw(:strategy);\& use IO::Compress::RawDeflate qw(:constants);\& use IO::Compress::RawDeflate qw(:all);.Ve.IP "\-Strategy" 5.IX Item "-Strategy"Defines the strategy used to tune the compression. Use one of the symbolicconstants defined below..Sp.Vb 5\& Z_FILTERED\& Z_HUFFMAN_ONLY\& Z_RLE\& Z_FIXED\& Z_DEFAULT_STRATEGY.Ve.SpThe default is Z_DEFAULT_STRATEGY..ie n .IP """Strict => 0|1""" 5.el .IP "\f(CWStrict => 0|1\fR" 5.IX Item "Strict => 0|1"This is a placeholder option..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::RawDeflate 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::RawDeflateobject 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::RawDeflate\*(C'\fR. None are imported by default..IP ":all" 5.IX Item ":all"Imports \f(CW\*(C`rawdeflate\*(C'\fR, \f(CW$RawDeflateError\fR and all symbolicconstants that can be used by \f(CW\*(C`IO::Compress::RawDeflate\*(C'\fR. Same as doing this.Sp.Vb 1\& use IO::Compress::RawDeflate qw(rawdeflate $RawDeflateError :constants) ;.Ve.IP ":constants" 5.IX Item ":constants"Import all symbolic constants. Same as doing this.Sp.Vb 1\& use IO::Compress::RawDeflate 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::Compress::Gzip, IO::Uncompress::Gunzip, IO::Compress::Deflate, IO::Uncompress::Inflate, 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 + -