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

📄 compress::zlib.3

📁 视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.
💻 3
📖 第 1 页 / 共 3 页
字号:
.\" Automatically generated by Pod::Man 2.16 (Pod::Simple 3.05).\".\" Standard preamble:.\" ========================================================================.de Sh \" Subsection heading.br.if t .Sp.ne 5.PP\fB\\$1\fR.PP...de Sp \" Vertical space (when we can't use .PP).if t .sp .5v.if n .sp...de Vb \" Begin verbatim text.ft CW.nf.ne \\$1...de Ve \" End verbatim text.ft R.fi...\" Set up some character translations and predefined strings.  \*(-- will.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left.\" double quote, and \*(R" will give a right double quote.  \*(C+ will.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,.\" nothing in troff, for use with C<>..tr \(*W-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'.ie n \{\.    ds -- \(*W-.    ds PI pi.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch.    ds L" "".    ds R" "".    ds C` "".    ds C' ""'br\}.el\{\.    ds -- \|\(em\|.    ds PI \(*p.    ds L" ``.    ds R" '''br\}.\".\" Escape single quotes in literal strings from groff's Unicode transform..ie \n(.g .ds Aq \(aq.el       .ds Aq '.\".\" If the F register is turned on, we'll generate index entries on stderr for.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index.\" entries marked with X<> in POD.  Of course, you'll have to process the.\" output yourself in some meaningful fashion..ie \nF \{\.    de IX.    tm Index:\\$1\t\\n%\t"\\$2"...    nr % 0.    rr F.\}.el \{\.    de IX...\}.\".\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2)..\" Fear.  Run.  Save yourself.  No user-serviceable parts..    \" fudge factors for nroff and troff.if n \{\.    ds #H 0.    ds #V .8m.    ds #F .3m.    ds #[ \f1.    ds #] \fP.\}.if t \{\.    ds #H ((1u-(\\\\n(.fu%2u))*.13m).    ds #V .6m.    ds #F 0.    ds #[ \&.    ds #] \&.\}.    \" simple accents for nroff and troff.if n \{\.    ds ' \&.    ds ` \&.    ds ^ \&.    ds , \&.    ds ~ ~.    ds /.\}.if t \{\.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u".    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'.\}.    \" troff and (daisy-wheel) nroff accents.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'.ds 8 \h'\*(#H'\(*b\h'-\*(#H'.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#].ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#].ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#].ds ae a\h'-(\w'a'u*4/10)'e.ds Ae A\h'-(\w'A'u*4/10)'E.    \" corrections for vroff.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'.    \" for low resolution devices (crt and lpr).if \n(.H>23 .if \n(.V>19 \\{\.    ds : e.    ds 8 ss.    ds o a.    ds d- d\h'-1'\(ga.    ds D- D\h'-1'\(hy.    ds th \o'bp'.    ds Th \o'LP'.    ds ae ae.    ds Ae AE.\}.rm #[ #] #H #V #F C.\" ========================================================================.\".IX Title "Compress::Zlib 3".TH Compress::Zlib 3 "2007-12-18" "perl v5.10.0" "Perl Programmers Reference Guide".\" For nroff, turn off justification.  Always turn off hyphenation; it makes.\" way too many mistakes in technical documents..if n .ad l.nh.SH "NAME"Compress::Zlib \- Interface to zlib compression library.SH "SYNOPSIS".IX Header "SYNOPSIS".Vb 1\&    use Compress::Zlib ;\&\&    ($d, $status) = deflateInit( [OPT] ) ;\&    $status = $d\->deflate($input, $output) ;\&    $status = $d\->flush($output [, $flush_type]) ;\&    $d\->deflateParams(OPTS) ;\&    $d\->deflateTune(OPTS) ;\&    $d\->dict_adler() ;\&    $d\->crc32() ;\&    $d\->adler32() ;\&    $d\->total_in() ;\&    $d\->total_out() ;\&    $d\->msg() ;\&    $d\->get_Strategy();\&    $d\->get_Level();\&    $d\->get_BufSize();\&\&    ($i, $status) = inflateInit( [OPT] ) ;\&    $status = $i\->inflate($input, $output [, $eof]) ;\&    $status = $i\->inflateSync($input) ;\&    $i\->dict_adler() ;\&    $d\->crc32() ;\&    $d\->adler32() ;\&    $i\->total_in() ;\&    $i\->total_out() ;\&    $i\->msg() ;\&    $d\->get_BufSize();\&\&    $dest = compress($source) ;\&    $dest = uncompress($source) ;\&\&    $gz = gzopen($filename or filehandle, $mode) ;\&    $bytesread = $gz\->gzread($buffer [,$size]) ;\&    $bytesread = $gz\->gzreadline($line) ;\&    $byteswritten = $gz\->gzwrite($buffer) ;\&    $status = $gz\->gzflush($flush) ;\&    $offset = $gz\->gztell() ;\&    $status = $gz\->gzseek($offset, $whence) ;\&    $status = $gz\->gzclose() ;\&    $status = $gz\->gzeof() ;\&    $status = $gz\->gzsetparams($level, $strategy) ;\&    $errstring = $gz\->gzerror() ; \&    $gzerrno\&\&    $dest = Compress::Zlib::memGzip($buffer) ;\&    $dest = Compress::Zlib::memGunzip($buffer) ;\&\&    $crc = adler32($buffer [,$crc]) ;\&    $crc = crc32($buffer [,$crc]) ;\&\&    $crc = adler32_combine($crc1, $crc2, $len2)l\&    $crc = crc32_combine($adler1, $adler2, $len2)\&\&    ZLIB_VERSION\&    ZLIB_VERNUM.Ve.SH "DESCRIPTION".IX Header "DESCRIPTION"The \fICompress::Zlib\fR module provides a Perl interface to the \fIzlib\fRcompression library (see \*(L"\s-1AUTHOR\s0\*(R" for details about where to get\&\fIzlib\fR)..PPThe \f(CW\*(C`Compress::Zlib\*(C'\fR module can be split into two general areas offunctionality, namely a simple read/write interface to \fIgzip\fR filesand a low-level in-memory compression/decompression interface..PPEach of these areas will be discussed in the following sections..Sh "Notes for users of Compress::Zlib version 1".IX Subsection "Notes for users of Compress::Zlib version 1"The main change in \f(CW\*(C`Compress::Zlib\*(C'\fR version 2.x is that it does not nowinterface directly to the zlib library. Instead it uses the\&\f(CW\*(C`IO::Compress::Gzip\*(C'\fR and \f(CW\*(C`IO::Uncompress::Gunzip\*(C'\fR modules forreading/writing gzip files, and the \f(CW\*(C`Compress::Raw::Zlib\*(C'\fR module for somelow-level zlib access..PPThe interface provided by version 2 of this module should be 100% backwardcompatible with version 1. If you find a difference in the expectedbehaviour please contact the author (See \*(L"\s-1AUTHOR\s0\*(R"). See \*(L"\s-1GZIP\s0 \s-1INTERFACE\s0\*(R".PPWith the creation of the \f(CW\*(C`IO::Compress\*(C'\fR and \f(CW\*(C`IO::Uncompress\*(C'\fR modules nonew features are planned for \f(CW\*(C`Compress::Zlib\*(C'\fR \- the new modules doeverything that \f(CW\*(C`Compress::Zlib\*(C'\fR does and then some. Development on\&\f(CW\*(C`Compress::Zlib\*(C'\fR will be limited to bug fixes only..PPIf you are writing new code, your first port of call should be one of thenew \f(CW\*(C`IO::Compress\*(C'\fR or \f(CW\*(C`IO::Uncompress\*(C'\fR modules..SH "GZIP INTERFACE".IX Header "GZIP INTERFACE"A number of functions are supplied in \fIzlib\fR for reading and writing\&\fIgzip\fR files that conform to \s-1RFC\s0 1952. This module provides an interfaceto most of them..PPIf you have previously used \f(CW\*(C`Compress::Zlib\*(C'\fR 1.x, the followingenhancements/changes have been made to the \f(CW\*(C`gzopen\*(C'\fR interface:.IP "1." 5If you want to to open either \s-1STDIN\s0 or \s-1STDOUT\s0 with \f(CW\*(C`gzopen\*(C'\fR, you can nowoptionally use the special filename "\f(CW\*(C`\-\*(C'\fR" as a synonym for \f(CW\*(C`\e*STDIN\*(C'\fR and\&\f(CW\*(C`\e*STDOUT\*(C'\fR..IP "2." 5In \f(CW\*(C`Compress::Zlib\*(C'\fR version 1.x, \f(CW\*(C`gzopen\*(C'\fR used the zlib library to openthe underlying file. This made things especially tricky when a Perlfilehandle was passed to \f(CW\*(C`gzopen\*(C'\fR. Behind the scenes the numeric C filedescriptor had to be extracted from the Perl filehandle and this passed tothe zlib library..SpApart from being non-portable to some operating systems, this made itdifficult to use \f(CW\*(C`gzopen\*(C'\fR in situations where you wanted to extract/createa gzip data stream that is embedded in a larger file, without having toresort to opening and closing the file multiple times..SpIt also made it impossible to pass a perl filehandle that wasn't associatedwith a real filesystem file, like, say, an \f(CW\*(C`IO::String\*(C'\fR..SpIn \f(CW\*(C`Compress::Zlib\*(C'\fR version 2.x, the \f(CW\*(C`gzopen\*(C'\fR interface has beencompletely rewritten to use the IO::Compress::Gzipfor writing gzip files and IO::Uncompress::Gunzipfor reading gzip files. None of the limitations mentioned above apply..IP "3." 5Addition of \f(CW\*(C`gzseek\*(C'\fR to provide a restricted \f(CW\*(C`seek\*(C'\fR interface..IP "4." 5Added \f(CW\*(C`gztell\*(C'\fR..PPA more complete and flexible interface for reading/writing gzipfiles/buffers is included with the module \f(CW\*(C`IO\-Compress\-Zlib\*(C'\fR. SeeIO::Compress::Gzip andIO::Uncompress::Gunzip for more details..ie n .IP "\fB\fB$gz\fB = gzopen($filename, \f(BI$mode\fB)\fR" 5.el .IP "\fB\f(CB$gz\fB = gzopen($filename, \f(CB$mode\fB)\fR" 5.IX Item "$gz = gzopen($filename, $mode)".PD 0.ie n .IP "\fB\fB$gz\fB = gzopen($filehandle, \f(BI$mode\fB)\fR" 5.el .IP "\fB\f(CB$gz\fB = gzopen($filehandle, \f(CB$mode\fB)\fR" 5.IX Item "$gz = gzopen($filehandle, $mode)".PDThis function opens either the \fIgzip\fR file \f(CW$filename\fR for reading orwriting or attaches to the opened filehandle, \f(CW$filehandle\fR. It returns an object on success and \f(CW\*(C`undef\*(C'\fR on failure..SpWhen writing a gzip file this interface will \fIalways\fR create the smallestpossible gzip header (exactly 10 bytes). If you want greater control overwhat gets stored in the gzip header (like the original filename or acomment) use IO::Compress::Gzip instead. Similarly ifyou want to read the contents of the gzip header useIO::Uncompress::Gunzip..SpThe second parameter, \f(CW$mode\fR, is used to specify whether the file isopened for reading or writing and to optionally specify a compressionlevel and compression strategy when writing. The format of the \f(CW$mode\fRparameter is similar to the mode parameter to the 'C' function \f(CW\*(C`fopen\*(C'\fR,so \*(L"rb\*(R" is used to open for reading, \*(L"wb\*(R" for writing and \*(L"ab\*(R" forappending (writing at the end of the file)..SpTo specify a compression level when writing, append a digit between 0and 9 to the mode string \*(-- 0 means no compression and 9 means maximumcompression.If no compression level is specified Z_DEFAULT_COMPRESSION is used..SpTo specify the compression strategy when writing, append 'f' for filtereddata, 'h' for Huffman only compression, or 'R' for run-length encoding.If no strategy is specified Z_DEFAULT_STRATEGY is used..SpSo, for example, \*(L"wb9\*(R" means open for writing with the maximum compressionusing the default strategy and \*(L"wb4R\*(R" means open for writing with compressionlevel 4 and run-length encoding..SpRefer to the \fIzlib\fR documentation for the exact format of the \f(CW$mode\fRparameter..ie n .IP "\fB\fB$bytesread\fB = \f(BI$gz\fB\->gzread($buffer [, \f(CB$size\fB]) ;\fR" 5.el .IP "\fB\f(CB$bytesread\fB = \f(CB$gz\fB\->gzread($buffer [, \f(CB$size\fB]) ;\fR" 5.IX Item "$bytesread = $gz->gzread($buffer [, $size]) ;"Reads \f(CW$size\fR bytes from the compressed file into \f(CW$buffer\fR. If\&\f(CW$size\fR is not specified, it will default to 4096. If the scalar\&\f(CW$buffer\fR is not large enough, it will be extended automatically..SpReturns the number of bytes actually read. On \s-1EOF\s0 it returns 0 and inthe case of an error, \-1..ie n .IP "\fB\fB$bytesread\fB = \f(BI$gz\fB\->gzreadline($line) ;\fR" 5.el .IP "\fB\f(CB$bytesread\fB = \f(CB$gz\fB\->gzreadline($line) ;\fR" 5.IX Item "$bytesread = $gz->gzreadline($line) ;"Reads the next line from the compressed file into \f(CW$line\fR..SpReturns the number of bytes actually read. On \s-1EOF\s0 it returns 0 and inthe case of an error, \-1.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -