1<?xml version="1.0" encoding="ascii"?>
2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3          "DTD/xhtml1-transitional.dtd">
4<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5<head>
6  <title>googleapiclient.http._StreamSlice</title>
7  <link rel="stylesheet" href="epydoc.css" type="text/css" />
8  <script type="text/javascript" src="epydoc.js"></script>
9</head>
10
11<body bgcolor="white" text="black" link="blue" vlink="#204080"
12      alink="#204080">
13<!-- ==================== NAVIGATION BAR ==================== -->
14<table class="navbar" border="0" width="100%" cellpadding="0"
15       bgcolor="#a0c0ff" cellspacing="0">
16  <tr valign="middle">
17  <!-- Home link -->
18      <th>&nbsp;&nbsp;&nbsp;<a
19        href="googleapiclient-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>
20
21  <!-- Tree link -->
22      <th>&nbsp;&nbsp;&nbsp;<a
23        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
24
25  <!-- Index link -->
26      <th>&nbsp;&nbsp;&nbsp;<a
27        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>
28
29  <!-- Help link -->
30      <th>&nbsp;&nbsp;&nbsp;<a
31        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
32
33      <th class="navbar" width="100%"></th>
34  </tr>
35</table>
36<table width="100%" cellpadding="0" cellspacing="0">
37  <tr valign="top">
38    <td width="100%">
39      <span class="breadcrumbs">
40        <a href="googleapiclient-module.html">Package&nbsp;googleapiclient</a> ::
41        <a href="googleapiclient.http-module.html">Module&nbsp;http</a> ::
42        Class&nbsp;_StreamSlice
43      </span>
44    </td>
45    <td>
46      <table cellpadding="0" cellspacing="0">
47        <!-- hide/show private -->
48        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
49    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
50        <tr><td align="right"><span class="options"
51            >[<a href="frames.html" target="_top">frames</a
52            >]&nbsp;|&nbsp;<a href="googleapiclient.http._StreamSlice-class.html"
53            target="_top">no&nbsp;frames</a>]</span></td></tr>
54      </table>
55    </td>
56  </tr>
57</table>
58<!-- ==================== CLASS DESCRIPTION ==================== -->
59<h1 class="epydoc">Class _StreamSlice</h1><p class="nomargin-top"><span class="codelink"><a href="googleapiclient.http-pysrc.html#_StreamSlice">source&nbsp;code</a></span></p>
60<center>
61<center>  <map id="uml_class_diagram_for_googleap_37" name="uml_class_diagram_for_googleap_37">
62<area shape="rect" id="node1_2" href="googleapiclient.http._StreamSlice-class.html#__init__" title="Constructor." alt="" coords="17,38,252,58"/>
63<area shape="rect" id="node1_3" href="googleapiclient.http._StreamSlice-class.html#read" title="Read n bytes." alt="" coords="17,58,252,78"/>
64<area shape="rect" id="node1" href="googleapiclient.http._StreamSlice-class.html" title="Truncated stream." alt="" coords="5,5,264,84"/>
65</map>
66  <img src="uml_class_diagram_for_googleap_37.gif" alt='' usemap="#uml_class_diagram_for_googleap_37" ismap="ismap" class="graph-without-title" />
67</center>
68</center>
69<hr />
70<pre class="literalblock">
71Truncated stream.
72
73Takes a stream and presents a stream that is a slice of the original stream.
74This is used when uploading media in chunks. In later versions of Python a
75stream can be passed to httplib in place of the string of data to send. The
76problem is that httplib just blindly reads to the end of the stream. This
77wrapper presents a virtual stream that only reads to the end of the chunk.
78
79</pre>
80
81<!-- ==================== INSTANCE METHODS ==================== -->
82<a name="section-InstanceMethods"></a>
83<table class="summary" border="1" cellpadding="3"
84       cellspacing="0" width="100%" bgcolor="white">
85<tr bgcolor="#70b0f0" class="table-header">
86  <td colspan="2" class="table-header">
87    <table border="0" cellpadding="0" cellspacing="0" width="100%">
88      <tr valign="top">
89        <td align="left"><span class="table-header">Instance Methods</span></td>
90        <td align="right" valign="top"
91         ><span class="options">[<a href="#section-InstanceMethods"
92         class="privatelink" onclick="toggle_private();"
93         >hide private</a>]</span></td>
94      </tr>
95    </table>
96  </td>
97</tr>
98<tr>
99    <td width="15%" align="right" valign="top" class="summary">
100      <span class="summary-type">&nbsp;</span>
101    </td><td class="summary">
102      <table width="100%" cellpadding="0" cellspacing="0" border="0">
103        <tr>
104          <td><span class="summary-sig"><a href="googleapiclient.http._StreamSlice-class.html#__init__" class="summary-sig-name">__init__</a>(<span class="summary-sig-arg">self</span>,
105        <span class="summary-sig-arg">stream</span>,
106        <span class="summary-sig-arg">begin</span>,
107        <span class="summary-sig-arg">chunksize</span>)</span><br />
108      Constructor.</td>
109          <td align="right" valign="top">
110            <span class="codelink"><a href="googleapiclient.http-pysrc.html#_StreamSlice.__init__">source&nbsp;code</a></span>
111
112          </td>
113        </tr>
114      </table>
115
116    </td>
117  </tr>
118<tr>
119    <td width="15%" align="right" valign="top" class="summary">
120      <span class="summary-type">&nbsp;</span>
121    </td><td class="summary">
122      <table width="100%" cellpadding="0" cellspacing="0" border="0">
123        <tr>
124          <td><span class="summary-sig"><a href="googleapiclient.http._StreamSlice-class.html#read" class="summary-sig-name">read</a>(<span class="summary-sig-arg">self</span>,
125        <span class="summary-sig-arg">n</span>=<span class="summary-sig-default">-1</span>)</span><br />
126      Read n bytes.</td>
127          <td align="right" valign="top">
128            <span class="codelink"><a href="googleapiclient.http-pysrc.html#_StreamSlice.read">source&nbsp;code</a></span>
129
130          </td>
131        </tr>
132      </table>
133
134    </td>
135  </tr>
136  <tr>
137    <td colspan="2" class="summary">
138    <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>:
139      <code>__delattr__</code>,
140      <code>__format__</code>,
141      <code>__getattribute__</code>,
142      <code>__hash__</code>,
143      <code>__new__</code>,
144      <code>__reduce__</code>,
145      <code>__reduce_ex__</code>,
146      <code>__repr__</code>,
147      <code>__setattr__</code>,
148      <code>__sizeof__</code>,
149      <code>__str__</code>,
150      <code>__subclasshook__</code>
151      </p>
152    </td>
153  </tr>
154</table>
155<!-- ==================== PROPERTIES ==================== -->
156<a name="section-Properties"></a>
157<table class="summary" border="1" cellpadding="3"
158       cellspacing="0" width="100%" bgcolor="white">
159<tr bgcolor="#70b0f0" class="table-header">
160  <td colspan="2" class="table-header">
161    <table border="0" cellpadding="0" cellspacing="0" width="100%">
162      <tr valign="top">
163        <td align="left"><span class="table-header">Properties</span></td>
164        <td align="right" valign="top"
165         ><span class="options">[<a href="#section-Properties"
166         class="privatelink" onclick="toggle_private();"
167         >hide private</a>]</span></td>
168      </tr>
169    </table>
170  </td>
171</tr>
172  <tr>
173    <td colspan="2" class="summary">
174    <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>:
175      <code>__class__</code>
176      </p>
177    </td>
178  </tr>
179</table>
180<!-- ==================== METHOD DETAILS ==================== -->
181<a name="section-MethodDetails"></a>
182<table class="details" border="1" cellpadding="3"
183       cellspacing="0" width="100%" bgcolor="white">
184<tr bgcolor="#70b0f0" class="table-header">
185  <td colspan="2" class="table-header">
186    <table border="0" cellpadding="0" cellspacing="0" width="100%">
187      <tr valign="top">
188        <td align="left"><span class="table-header">Method Details</span></td>
189        <td align="right" valign="top"
190         ><span class="options">[<a href="#section-MethodDetails"
191         class="privatelink" onclick="toggle_private();"
192         >hide private</a>]</span></td>
193      </tr>
194    </table>
195  </td>
196</tr>
197</table>
198<a name="__init__"></a>
199<div>
200<table class="details" border="1" cellpadding="3"
201       cellspacing="0" width="100%" bgcolor="white">
202<tr><td>
203  <table width="100%" cellpadding="0" cellspacing="0" border="0">
204  <tr valign="top"><td>
205  <h3 class="epydoc"><span class="sig"><span class="sig-name">__init__</span>(<span class="sig-arg">self</span>,
206        <span class="sig-arg">stream</span>,
207        <span class="sig-arg">begin</span>,
208        <span class="sig-arg">chunksize</span>)</span>
209    <br /><em class="fname">(Constructor)</em>
210  </h3>
211  </td><td align="right" valign="top"
212    ><span class="codelink"><a href="googleapiclient.http-pysrc.html#_StreamSlice.__init__">source&nbsp;code</a></span>&nbsp;
213    </td>
214  </tr></table>
215
216  <pre class="literalblock">
217Constructor.
218
219Args:
220  stream: (io.Base, file object), the stream to wrap.
221  begin: int, the seek position the chunk begins at.
222  chunksize: int, the size of the chunk.
223
224</pre>
225  <dl class="fields">
226    <dt>Overrides:
227        object.__init__
228    </dt>
229  </dl>
230</td></tr></table>
231</div>
232<a name="read"></a>
233<div>
234<table class="details" border="1" cellpadding="3"
235       cellspacing="0" width="100%" bgcolor="white">
236<tr><td>
237  <table width="100%" cellpadding="0" cellspacing="0" border="0">
238  <tr valign="top"><td>
239  <h3 class="epydoc"><span class="sig"><span class="sig-name">read</span>(<span class="sig-arg">self</span>,
240        <span class="sig-arg">n</span>=<span class="sig-default">-1</span>)</span>
241  </h3>
242  </td><td align="right" valign="top"
243    ><span class="codelink"><a href="googleapiclient.http-pysrc.html#_StreamSlice.read">source&nbsp;code</a></span>&nbsp;
244    </td>
245  </tr></table>
246
247  <pre class="literalblock">
248Read n bytes.
249
250Args:
251  n, int, the number of bytes to read.
252
253Returns:
254  A string of length 'n', or less if EOF is reached.
255
256</pre>
257  <dl class="fields">
258  </dl>
259</td></tr></table>
260</div>
261<br />
262<!-- ==================== NAVIGATION BAR ==================== -->
263<table class="navbar" border="0" width="100%" cellpadding="0"
264       bgcolor="#a0c0ff" cellspacing="0">
265  <tr valign="middle">
266  <!-- Home link -->
267      <th>&nbsp;&nbsp;&nbsp;<a
268        href="googleapiclient-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>
269
270  <!-- Tree link -->
271      <th>&nbsp;&nbsp;&nbsp;<a
272        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
273
274  <!-- Index link -->
275      <th>&nbsp;&nbsp;&nbsp;<a
276        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>
277
278  <!-- Help link -->
279      <th>&nbsp;&nbsp;&nbsp;<a
280        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
281
282      <th class="navbar" width="100%"></th>
283  </tr>
284</table>
285<table border="0" cellpadding="0" cellspacing="0" width="100%%">
286  <tr>
287    <td align="left" class="footer">
288    Generated by Epydoc 3.0.1 on Fri Jun 14 15:57:28 2019
289    </td>
290    <td align="right" class="footer">
291      <a target="mainFrame" href="http://epydoc.sourceforge.net"
292        >http://epydoc.sourceforge.net</a>
293    </td>
294  </tr>
295</table>
296
297<script type="text/javascript">
298  <!--
299  // Private objects are initially displayed (because if
300  // javascript is turned off then we want them to be
301  // visible); but by default, we want to hide them.  So hide
302  // them unless we have a cookie that says to show them.
303  checkCookie();
304  // -->
305</script>
306</body>
307</html>
308