Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / v8plus / html / python / lib / node407.html
CommitLineData
920dae64
AT
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<html>
3<head>
4<link rel="STYLESHEET" href="lib.css" type='text/css' />
5<link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" />
6<link rel='start' href='../index.html' title='Python Documentation Index' />
7<link rel="first" href="lib.html" title='Python Library Reference' />
8<link rel='contents' href='contents.html' title="Contents" />
9<link rel='index' href='genindex.html' title='Index' />
10<link rel='last' href='about.html' title='About this document...' />
11<link rel='help' href='about.html' title='About this document...' />
12<link rel="next" href="node408.html" />
13<link rel="prev" href="node406.html" />
14<link rel="parent" href="module-bz2.html" />
15<link rel="next" href="node408.html" />
16<meta name='aesop' content='information' />
17<title>7.17.2 Sequential (de)compression</title>
18</head>
19<body>
20<DIV CLASS="navigation">
21<div id='top-navigation-panel' xml:id='top-navigation-panel'>
22<table align="center" width="100%" cellpadding="0" cellspacing="2">
23<tr>
24<td class='online-navigation'><a rel="prev" title="7.17.1 (De)compression of files"
25 href="node406.html"><img src='../icons/previous.png'
26 border='0' height='32' alt='Previous Page' width='32' /></A></td>
27<td class='online-navigation'><a rel="parent" title="7.17 bz2 "
28 href="module-bz2.html"><img src='../icons/up.png'
29 border='0' height='32' alt='Up One Level' width='32' /></A></td>
30<td class='online-navigation'><a rel="next" title="7.17.3 One-shot (de)compression"
31 href="node408.html"><img src='../icons/next.png'
32 border='0' height='32' alt='Next Page' width='32' /></A></td>
33<td align="center" width="100%">Python Library Reference</td>
34<td class='online-navigation'><a rel="contents" title="Table of Contents"
35 href="contents.html"><img src='../icons/contents.png'
36 border='0' height='32' alt='Contents' width='32' /></A></td>
37<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
38 border='0' height='32' alt='Module Index' width='32' /></a></td>
39<td class='online-navigation'><a rel="index" title="Index"
40 href="genindex.html"><img src='../icons/index.png'
41 border='0' height='32' alt='Index' width='32' /></A></td>
42</tr></table>
43<div class='online-navigation'>
44<b class="navlabel">Previous:</b>
45<a class="sectref" rel="prev" href="node406.html">7.17.1 (De)compression of files</A>
46<b class="navlabel">Up:</b>
47<a class="sectref" rel="parent" href="module-bz2.html">7.17 bz2 </A>
48<b class="navlabel">Next:</b>
49<a class="sectref" rel="next" href="node408.html">7.17.3 One-shot (de)compression</A>
50</div>
51<hr /></div>
52</DIV>
53<!--End of Navigation Panel-->
54
55<H2><A NAME="SECTION0091720000000000000000">
567.17.2 Sequential (de)compression</A>
57</H2>
58
59<P>
60Sequential compression and decompression is done using the classes
61<tt class="class">BZ2Compressor</tt> and <tt class="class">BZ2Decompressor</tt>.
62
63<P>
64<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
65 <td><nobr><b><span class="typelabel">class</span>&nbsp;<tt id='l2h-2843' xml:id='l2h-2843' class="class">BZ2Compressor</tt></b>(</nobr></td>
66 <td><var></var><big>[</big><var>compresslevel</var><big>]</big><var></var>)</td></tr></table></dt>
67<dd>
68Create a new compressor object. This object may be used to compress
69data sequentially. If you want to compress data in one shot, use the
70<tt class="function">compress()</tt> function instead. The <var>compresslevel</var> parameter,
71if given, must be a number between <code>1</code> and <code>9</code>; the default
72is <code>9</code>.
73</dl>
74
75<P>
76<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
77 <td><nobr><b><tt id='l2h-2844' xml:id='l2h-2844' class="method">compress</tt></b>(</nobr></td>
78 <td><var>data</var>)</td></tr></table></dt>
79<dd>
80Provide more data to the compressor object. It will return chunks of compressed
81data whenever possible. When you've finished providing data to compress, call
82the <tt class="method">flush()</tt> method to finish the compression process, and return what
83is left in internal buffers.
84</dl>
85
86<P>
87<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
88 <td><nobr><b><tt id='l2h-2845' xml:id='l2h-2845' class="method">flush</tt></b>(</nobr></td>
89 <td><var></var>)</td></tr></table></dt>
90<dd>
91Finish the compression process and return what is left in internal buffers. You
92must not use the compressor object after calling this method.
93</dl>
94
95<P>
96<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
97 <td><nobr><b><span class="typelabel">class</span>&nbsp;<tt id='l2h-2846' xml:id='l2h-2846' class="class">BZ2Decompressor</tt></b>(</nobr></td>
98 <td><var></var>)</td></tr></table></dt>
99<dd>
100Create a new decompressor object. This object may be used to decompress
101data sequentially. If you want to decompress data in one shot, use the
102<tt class="function">decompress()</tt> function instead.
103</dl>
104
105<P>
106<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
107 <td><nobr><b><tt id='l2h-2847' xml:id='l2h-2847' class="method">decompress</tt></b>(</nobr></td>
108 <td><var>data</var>)</td></tr></table></dt>
109<dd>
110Provide more data to the decompressor object. It will return chunks of
111decompressed data whenever possible. If you try to decompress data after the
112end of stream is found, <tt class="exception">EOFError</tt> will be raised. If any data was
113found after the end of stream, it'll be ignored and saved in
114<tt class="member">unused_data</tt> attribute.
115</dl>
116
117<P>
118
119<DIV CLASS="navigation">
120<div class='online-navigation'>
121<p></p><hr />
122<table align="center" width="100%" cellpadding="0" cellspacing="2">
123<tr>
124<td class='online-navigation'><a rel="prev" title="7.17.1 (De)compression of files"
125 href="node406.html"><img src='../icons/previous.png'
126 border='0' height='32' alt='Previous Page' width='32' /></A></td>
127<td class='online-navigation'><a rel="parent" title="7.17 bz2 "
128 href="module-bz2.html"><img src='../icons/up.png'
129 border='0' height='32' alt='Up One Level' width='32' /></A></td>
130<td class='online-navigation'><a rel="next" title="7.17.3 One-shot (de)compression"
131 href="node408.html"><img src='../icons/next.png'
132 border='0' height='32' alt='Next Page' width='32' /></A></td>
133<td align="center" width="100%">Python Library Reference</td>
134<td class='online-navigation'><a rel="contents" title="Table of Contents"
135 href="contents.html"><img src='../icons/contents.png'
136 border='0' height='32' alt='Contents' width='32' /></A></td>
137<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
138 border='0' height='32' alt='Module Index' width='32' /></a></td>
139<td class='online-navigation'><a rel="index" title="Index"
140 href="genindex.html"><img src='../icons/index.png'
141 border='0' height='32' alt='Index' width='32' /></A></td>
142</tr></table>
143<div class='online-navigation'>
144<b class="navlabel">Previous:</b>
145<a class="sectref" rel="prev" href="node406.html">7.17.1 (De)compression of files</A>
146<b class="navlabel">Up:</b>
147<a class="sectref" rel="parent" href="module-bz2.html">7.17 bz2 </A>
148<b class="navlabel">Next:</b>
149<a class="sectref" rel="next" href="node408.html">7.17.3 One-shot (de)compression</A>
150</div>
151</div>
152<hr />
153<span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span>
154</DIV>
155<!--End of Navigation Panel-->
156<ADDRESS>
157See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
158</ADDRESS>
159</BODY>
160</HTML>