⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 deflate.pm

📁 视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.
💻 PM
📖 第 1 页 / 共 2 页
字号:
If the C<$output> parameter is a filehandle, the compressed data will bewritten to it.The string '-' can be used as an alias for standard output.=item A scalar reference If C<$output> is a scalar reference, the compressed data will be storedin C<$$output>.=backIf the C<$output> parameter is any other type, C<IO::Compress::Deflate>::new willreturn undef.=head2 Constructor OptionsC<OPTS> is any combination of the following options:=over 5=item C<< AutoClose => 0|1 >>This option is only valid when the C<$output> parameter is a filehandle. Ifspecified, and the value is true, it will result in the C<$output> beingclosed once either the C<close> method is called or the C<IO::Compress::Deflate>object is destroyed.This parameter defaults to 0.=item C<< Append => 0|1 >>Opens C<$output> in append mode. The behaviour of this option is dependent on the type of C<$output>.=over 5=item * A BufferIf C<$output> is a buffer and C<Append> is enabled, all compressed datawill be append to the end if C<$output>. Otherwise C<$output> will becleared before any data is written to it.=item * A FilenameIf C<$output> is a filename and C<Append> 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.=item * A FilehandleIf C<$output> is a filehandle, the file pointer will be positioned to theend of the file via a call to C<seek> before any compressed data is writtento it.  Otherwise the file pointer will not be moved.=backThis parameter defaults to 0.=item C<< Merge => 0|1 >>This option is used to compress input data and append it to an existingcompressed data stream in C<$output>. The end result is a single compresseddata stream stored in C<$output>. It is a fatal error to attempt to use this option when C<$output> is not anRFC 1950 data stream.There are a number of other limitations with the C<Merge> option:=over 5 =item 1This module needs to have been built with zlib 1.2.1 or better to work. Afatal error will be thrown if C<Merge> is used with an older version ofzlib.  =item 2If C<$output> is a file or a filehandle, it must be seekable.=backThis parameter defaults to 0.=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.   Z_NO_COMPRESSION   Z_BEST_SPEED   Z_BEST_COMPRESSION   Z_DEFAULT_COMPRESSIONThe default is Z_DEFAULT_COMPRESSION.Note, these constants are not imported by C<IO::Compress::Deflate> by default.    use IO::Compress::Deflate qw(:strategy);    use IO::Compress::Deflate qw(:constants);    use IO::Compress::Deflate qw(:all);=item -Strategy Defines the strategy used to tune the compression. Use one of the symbolicconstants defined below.   Z_FILTERED   Z_HUFFMAN_ONLY   Z_RLE   Z_FIXED   Z_DEFAULT_STRATEGYThe default is Z_DEFAULT_STRATEGY.=item C<< Strict => 0|1 >>This is a placeholder option.=back=head2 ExamplesTODO=head1 Methods =head2 printUsage is    $z->print($data)    print $z $dataCompresses and outputs the contents of the C<$data> parameter. Thishas the same behaviour as the C<print> built-in.Returns true if successful.=head2 printfUsage is    $z->printf($format, $data)    printf $z $format, $dataCompresses and outputs the contents of the C<$data> parameter.Returns true if successful.=head2 syswriteUsage is    $z->syswrite $data    $z->syswrite $data, $length    $z->syswrite $data, $length, $offsetCompresses and outputs the contents of the C<$data> parameter.Returns the number of uncompressed bytes written, or C<undef> ifunsuccessful.=head2 writeUsage is    $z->write $data    $z->write $data, $length    $z->write $data, $length, $offsetCompresses and outputs the contents of the C<$data> parameter.Returns the number of uncompressed bytes written, or C<undef> ifunsuccessful.=head2 flushUsage is    $z->flush;    $z->flush($flush_type);Flushes any pending compressed data to the output file/buffer.This method takes an optional parameter, C<$flush_type>, that controlshow the flushing will be carried out. By default the C<$flush_type>used is C<Z_FINISH>. Other valid values for C<$flush_type> areC<Z_NO_FLUSH>, C<Z_SYNC_FLUSH>, C<Z_FULL_FLUSH> and C<Z_BLOCK>. It isstrongly recommended that you only set the C<flush_type> parameter ifyou fully understand the implications of what it does - overuse of C<flush>can seriously degrade the level of compression achieved. See the C<zlib>documentation for details.Returns true on success.=head2 tellUsage is    $z->tell()    tell $zReturns the uncompressed file offset.=head2 eofUsage is    $z->eof();    eof($z);Returns true if the C<close> method has been called.=head2 seek    $z->seek($position, $whence);    seek($z, $position, $whence);Provides a sub-set of the C<seek> 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.Empty parts of the file/buffer will have NULL (0x00) bytes written to them.The C<$whence> parameter takes one the usual values, namely SEEK_SET,SEEK_CUR or SEEK_END.Returns 1 on success, 0 on failure.=head2 binmodeUsage is    $z->binmode    binmode $z ;This is a noop provided for completeness.=head2 opened    $z->opened()Returns true if the object currently refers to a opened file/buffer. =head2 autoflush    my $prev = $z->autoflush()    my $prev = $z->autoflush(EXPR)If the C<$z> object is associated with a file or a filehandle, this methodreturns the current autoflush setting for the underlying filehandle. IfC<EXPR> is present, and is non-zero, it will enable flushing after everywrite/print operation.If C<$z> is associated with a buffer, this method has no effect and alwaysreturns C<undef>.B<Note> that the special variable C<$|> B<cannot> be used to set orretrieve the autoflush setting.=head2 input_line_number    $z->input_line_number()    $z->input_line_number(EXPR)This method always returns C<undef> when compressing. =head2 fileno    $z->fileno()    fileno($z)If the C<$z> object is associated with a file or a filehandle, this methodwill return the underlying file descriptor.If the C<$z> object is is associated with a buffer, this method willreturn undef.=head2 close    $z->close() ;    close $z ;Flushes any pending compressed data and then closes the output file/buffer. For most versions of Perl this method will be automatically invoked ifthe IO::Compress::Deflate 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 C<close> method will be called automatically, butnot until global destruction of all live objects when the program isterminating.Therefore, if you want your scripts to be able to run on all versionsof Perl, you should call C<close> explicitly and not rely on automaticclosing.Returns true on success, otherwise 0.If the C<AutoClose> option has been enabled when the IO::Compress::Deflateobject was created, and the object is associated with a file, theunderlying file will also be closed.=head2 newStream([OPTS])Usage is    $z->newStream( [OPTS] )Closes the current compressed data stream and starts a new one.OPTS consists of any of the the options that are available when creatingthe C<$z> object.See the L</"Constructor Options"> section for more details.=head2 deflateParamsUsage is    $z->deflateParamsTODO=head1 Importing A number of symbolic constants are required by some methods in C<IO::Compress::Deflate>. None are imported by default.=over 5=item :allImports C<deflate>, C<$DeflateError> and all symbolicconstants that can be used by C<IO::Compress::Deflate>. Same as doing this    use IO::Compress::Deflate qw(deflate $DeflateError :constants) ;=item :constantsImport all symbolic constants. Same as doing this    use IO::Compress::Deflate qw(:flush :level :strategy) ;=item :flushThese symbolic constants are used by the C<flush> method.    Z_NO_FLUSH    Z_PARTIAL_FLUSH    Z_SYNC_FLUSH    Z_FULL_FLUSH    Z_FINISH    Z_BLOCK=item :levelThese symbolic constants are used by the C<Level> option in the constructor.    Z_NO_COMPRESSION    Z_BEST_SPEED    Z_BEST_COMPRESSION    Z_DEFAULT_COMPRESSION=item :strategyThese symbolic constants are used by the C<Strategy> option in the constructor.    Z_FILTERED    Z_HUFFMAN_ONLY    Z_RLE    Z_FIXED    Z_DEFAULT_STRATEGY        =backFor =head1 EXAMPLESTODO=head1 SEE ALSOL<Compress::Zlib>, L<IO::Compress::Gzip>, L<IO::Uncompress::Gunzip>, L<IO::Uncompress::Inflate>, L<IO::Compress::RawDeflate>, L<IO::Uncompress::RawInflate>, L<IO::Compress::Bzip2>, L<IO::Uncompress::Bunzip2>, L<IO::Compress::Lzop>, L<IO::Uncompress::UnLzop>, L<IO::Compress::Lzf>, L<IO::Uncompress::UnLzf>, L<IO::Uncompress::AnyInflate>, L<IO::Uncompress::AnyUncompress>L<Compress::Zlib::FAQ|Compress::Zlib::FAQ>L<File::GlobMapper|File::GlobMapper>, L<Archive::Zip|Archive::Zip>,L<Archive::Tar|Archive::Tar>,L<IO::Zlib|IO::Zlib>For RFC 1950, 1951 and 1952 see F<http://www.faqs.org/rfcs/rfc1950.html>,F<http://www.faqs.org/rfcs/rfc1951.html> andF<http://www.faqs.org/rfcs/rfc1952.html>The I<zlib> compression library was written by Jean-loup GaillyF<gzip@prep.ai.mit.edu> and Mark Adler F<madler@alumni.caltech.edu>.The primary site for the I<zlib> compression library isF<http://www.zlib.org>.The primary site for gzip is F<http://www.gzip.org>.=head1 AUTHORThis module was written by Paul Marquess, F<pmqs@cpan.org>. =head1 MODIFICATION HISTORYSee the Changes file.=head1 COPYRIGHT AND LICENSECopyright (c) 2005-2007 Paul Marquess. All rights reserved.This 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 + -