~dkuhlman/python-training-materials/Materials

« back to all changes in this revision

Viewing changes to python-3.5.1-docs-html/c-api/bytearray.html

  • Committer: Dave Kuhlman
  • Date: 2017-04-15 16:24:56 UTC
  • Revision ID: dkuhlman@davekuhlman.org-20170415162456-iav9vozzg4iwqwv3
Updated docs

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
 
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
 
 
4
 
 
5
 
<html xmlns="http://www.w3.org/1999/xhtml">
6
 
  <head>
7
 
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
8
 
    
9
 
    <title>Byte Array Objects &mdash; Python 3.5.1 documentation</title>
10
 
    
11
 
    <link rel="stylesheet" href="../_static/pydoctheme.css" type="text/css" />
12
 
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
13
 
    
14
 
    <script type="text/javascript">
15
 
      var DOCUMENTATION_OPTIONS = {
16
 
        URL_ROOT:    '../',
17
 
        VERSION:     '3.5.1',
18
 
        COLLAPSE_INDEX: false,
19
 
        FILE_SUFFIX: '.html',
20
 
        HAS_SOURCE:  true
21
 
      };
22
 
    </script>
23
 
    <script type="text/javascript" src="../_static/jquery.js"></script>
24
 
    <script type="text/javascript" src="../_static/underscore.js"></script>
25
 
    <script type="text/javascript" src="../_static/doctools.js"></script>
26
 
    <script type="text/javascript" src="../_static/sidebar.js"></script>
27
 
    <link rel="search" type="application/opensearchdescription+xml"
28
 
          title="Search within Python 3.5.1 documentation"
29
 
          href="../_static/opensearch.xml"/>
30
 
    <link rel="author" title="About these documents" href="../about.html" />
31
 
    <link rel="copyright" title="Copyright" href="../copyright.html" />
32
 
    <link rel="top" title="Python 3.5.1 documentation" href="../contents.html" />
33
 
    <link rel="up" title="Concrete Objects Layer" href="concrete.html" />
34
 
    <link rel="next" title="Unicode Objects and Codecs" href="unicode.html" />
35
 
    <link rel="prev" title="Bytes Objects" href="bytes.html" />
36
 
    <link rel="shortcut icon" type="image/png" href="../_static/py.png" />
37
 
    <script type="text/javascript" src="../_static/copybutton.js"></script>
38
 
    <script type="text/javascript" src="../_static/version_switch.js"></script>
39
 
    
40
 
 
41
 
 
42
 
  </head>
43
 
  <body role="document">  
44
 
    <div class="related" role="navigation" aria-label="related navigation">
45
 
      <h3>Navigation</h3>
46
 
      <ul>
47
 
        <li class="right" style="margin-right: 10px">
48
 
          <a href="../genindex.html" title="General Index"
49
 
             accesskey="I">index</a></li>
50
 
        <li class="right" >
51
 
          <a href="../py-modindex.html" title="Python Module Index"
52
 
             >modules</a> |</li>
53
 
        <li class="right" >
54
 
          <a href="unicode.html" title="Unicode Objects and Codecs"
55
 
             accesskey="N">next</a> |</li>
56
 
        <li class="right" >
57
 
          <a href="bytes.html" title="Bytes Objects"
58
 
             accesskey="P">previous</a> |</li>
59
 
        <li><img src="../_static/py.png" alt=""
60
 
                 style="vertical-align: middle; margin-top: -1px"/></li>
61
 
        <li><a href="https://www.python.org/">Python</a> &raquo;</li>
62
 
        <li>
63
 
          <span class="version_switcher_placeholder">3.5.1</span>
64
 
          <a href="../index.html">Documentation </a> &raquo;
65
 
        </li>
66
 
 
67
 
          <li class="nav-item nav-item-1"><a href="index.html" >Python/C API Reference Manual</a> &raquo;</li>
68
 
          <li class="nav-item nav-item-2"><a href="concrete.html" accesskey="U">Concrete Objects Layer</a> &raquo;</li> 
69
 
      </ul>
70
 
    </div>    
71
 
 
72
 
    <div class="document">
73
 
      <div class="documentwrapper">
74
 
        <div class="bodywrapper">
75
 
          <div class="body" role="main">
76
 
            
77
 
  <div class="section" id="byte-array-objects">
78
 
<span id="bytearrayobjects"></span><h1>Byte Array Objects<a class="headerlink" href="#byte-array-objects" title="Permalink to this headline">¶</a></h1>
79
 
<span class="target" id="index-0"></span><dl class="type">
80
 
<dt id="c.PyByteArrayObject">
81
 
<code class="descname">PyByteArrayObject</code><a class="headerlink" href="#c.PyByteArrayObject" title="Permalink to this definition">¶</a></dt>
82
 
<dd><p>This subtype of <a class="reference internal" href="structures.html#c.PyObject" title="PyObject"><code class="xref c c-type docutils literal"><span class="pre">PyObject</span></code></a> represents a Python bytearray object.</p>
83
 
</dd></dl>
84
 
 
85
 
<dl class="var">
86
 
<dt id="c.PyByteArray_Type">
87
 
<a class="reference internal" href="type.html#c.PyTypeObject" title="PyTypeObject">PyTypeObject</a> <code class="descname">PyByteArray_Type</code><a class="headerlink" href="#c.PyByteArray_Type" title="Permalink to this definition">¶</a></dt>
88
 
<dd><p>This instance of <a class="reference internal" href="type.html#c.PyTypeObject" title="PyTypeObject"><code class="xref c c-type docutils literal"><span class="pre">PyTypeObject</span></code></a> represents the Python bytearray type;
89
 
it is the same object as <a class="reference internal" href="../library/functions.html#bytearray" title="bytearray"><code class="xref py py-class docutils literal"><span class="pre">bytearray</span></code></a> in the Python layer.</p>
90
 
</dd></dl>
91
 
 
92
 
<div class="section" id="type-check-macros">
93
 
<h2>Type check macros<a class="headerlink" href="#type-check-macros" title="Permalink to this headline">¶</a></h2>
94
 
<dl class="function">
95
 
<dt id="c.PyByteArray_Check">
96
 
int <code class="descname">PyByteArray_Check</code><span class="sig-paren">(</span><a class="reference internal" href="structures.html#c.PyObject" title="PyObject">PyObject</a><em>&nbsp;*o</em><span class="sig-paren">)</span><a class="headerlink" href="#c.PyByteArray_Check" title="Permalink to this definition">¶</a></dt>
97
 
<dd><p>Return true if the object <em>o</em> is a bytearray object or an instance of a
98
 
subtype of the bytearray type.</p>
99
 
</dd></dl>
100
 
 
101
 
<dl class="function">
102
 
<dt id="c.PyByteArray_CheckExact">
103
 
int <code class="descname">PyByteArray_CheckExact</code><span class="sig-paren">(</span><a class="reference internal" href="structures.html#c.PyObject" title="PyObject">PyObject</a><em>&nbsp;*o</em><span class="sig-paren">)</span><a class="headerlink" href="#c.PyByteArray_CheckExact" title="Permalink to this definition">¶</a></dt>
104
 
<dd><p>Return true if the object <em>o</em> is a bytearray object, but not an instance of a
105
 
subtype of the bytearray type.</p>
106
 
</dd></dl>
107
 
 
108
 
</div>
109
 
<div class="section" id="direct-api-functions">
110
 
<h2>Direct API functions<a class="headerlink" href="#direct-api-functions" title="Permalink to this headline">¶</a></h2>
111
 
<dl class="function">
112
 
<dt id="c.PyByteArray_FromObject">
113
 
<a class="reference internal" href="structures.html#c.PyObject" title="PyObject">PyObject</a>* <code class="descname">PyByteArray_FromObject</code><span class="sig-paren">(</span><a class="reference internal" href="structures.html#c.PyObject" title="PyObject">PyObject</a><em>&nbsp;*o</em><span class="sig-paren">)</span><a class="headerlink" href="#c.PyByteArray_FromObject" title="Permalink to this definition">¶</a></dt>
114
 
<dd><p>Return a new bytearray object from any object, <em>o</em>, that implements the
115
 
<a class="reference internal" href="buffer.html#bufferobjects"><span>buffer protocol</span></a>.</p>
116
 
</dd></dl>
117
 
 
118
 
<dl class="function">
119
 
<dt id="c.PyByteArray_FromStringAndSize">
120
 
<a class="reference internal" href="structures.html#c.PyObject" title="PyObject">PyObject</a>* <code class="descname">PyByteArray_FromStringAndSize</code><span class="sig-paren">(</span>const char<em>&nbsp;*string</em>, Py_ssize_t<em>&nbsp;len</em><span class="sig-paren">)</span><a class="headerlink" href="#c.PyByteArray_FromStringAndSize" title="Permalink to this definition">¶</a></dt>
121
 
<dd><p>Create a new bytearray object from <em>string</em> and its length, <em>len</em>.  On
122
 
failure, <em>NULL</em> is returned.</p>
123
 
</dd></dl>
124
 
 
125
 
<dl class="function">
126
 
<dt id="c.PyByteArray_Concat">
127
 
<a class="reference internal" href="structures.html#c.PyObject" title="PyObject">PyObject</a>* <code class="descname">PyByteArray_Concat</code><span class="sig-paren">(</span><a class="reference internal" href="structures.html#c.PyObject" title="PyObject">PyObject</a><em>&nbsp;*a</em>, <a class="reference internal" href="structures.html#c.PyObject" title="PyObject">PyObject</a><em>&nbsp;*b</em><span class="sig-paren">)</span><a class="headerlink" href="#c.PyByteArray_Concat" title="Permalink to this definition">¶</a></dt>
128
 
<dd><p>Concat bytearrays <em>a</em> and <em>b</em> and return a new bytearray with the result.</p>
129
 
</dd></dl>
130
 
 
131
 
<dl class="function">
132
 
<dt id="c.PyByteArray_Size">
133
 
Py_ssize_t <code class="descname">PyByteArray_Size</code><span class="sig-paren">(</span><a class="reference internal" href="structures.html#c.PyObject" title="PyObject">PyObject</a><em>&nbsp;*bytearray</em><span class="sig-paren">)</span><a class="headerlink" href="#c.PyByteArray_Size" title="Permalink to this definition">¶</a></dt>
134
 
<dd><p>Return the size of <em>bytearray</em> after checking for a <em>NULL</em> pointer.</p>
135
 
</dd></dl>
136
 
 
137
 
<dl class="function">
138
 
<dt id="c.PyByteArray_AsString">
139
 
char* <code class="descname">PyByteArray_AsString</code><span class="sig-paren">(</span><a class="reference internal" href="structures.html#c.PyObject" title="PyObject">PyObject</a><em>&nbsp;*bytearray</em><span class="sig-paren">)</span><a class="headerlink" href="#c.PyByteArray_AsString" title="Permalink to this definition">¶</a></dt>
140
 
<dd><p>Return the contents of <em>bytearray</em> as a char array after checking for a
141
 
<em>NULL</em> pointer.  The returned array always has an extra
142
 
null byte appended.</p>
143
 
</dd></dl>
144
 
 
145
 
<dl class="function">
146
 
<dt id="c.PyByteArray_Resize">
147
 
int <code class="descname">PyByteArray_Resize</code><span class="sig-paren">(</span><a class="reference internal" href="structures.html#c.PyObject" title="PyObject">PyObject</a><em>&nbsp;*bytearray</em>, Py_ssize_t<em>&nbsp;len</em><span class="sig-paren">)</span><a class="headerlink" href="#c.PyByteArray_Resize" title="Permalink to this definition">¶</a></dt>
148
 
<dd><p>Resize the internal buffer of <em>bytearray</em> to <em>len</em>.</p>
149
 
</dd></dl>
150
 
 
151
 
</div>
152
 
<div class="section" id="macros">
153
 
<h2>Macros<a class="headerlink" href="#macros" title="Permalink to this headline">¶</a></h2>
154
 
<p>These macros trade safety for speed and they don&#8217;t check pointers.</p>
155
 
<dl class="function">
156
 
<dt id="c.PyByteArray_AS_STRING">
157
 
char* <code class="descname">PyByteArray_AS_STRING</code><span class="sig-paren">(</span><a class="reference internal" href="structures.html#c.PyObject" title="PyObject">PyObject</a><em>&nbsp;*bytearray</em><span class="sig-paren">)</span><a class="headerlink" href="#c.PyByteArray_AS_STRING" title="Permalink to this definition">¶</a></dt>
158
 
<dd><p>Macro version of <a class="reference internal" href="#c.PyByteArray_AsString" title="PyByteArray_AsString"><code class="xref c c-func docutils literal"><span class="pre">PyByteArray_AsString()</span></code></a>.</p>
159
 
</dd></dl>
160
 
 
161
 
<dl class="function">
162
 
<dt id="c.PyByteArray_GET_SIZE">
163
 
Py_ssize_t <code class="descname">PyByteArray_GET_SIZE</code><span class="sig-paren">(</span><a class="reference internal" href="structures.html#c.PyObject" title="PyObject">PyObject</a><em>&nbsp;*bytearray</em><span class="sig-paren">)</span><a class="headerlink" href="#c.PyByteArray_GET_SIZE" title="Permalink to this definition">¶</a></dt>
164
 
<dd><p>Macro version of <a class="reference internal" href="#c.PyByteArray_Size" title="PyByteArray_Size"><code class="xref c c-func docutils literal"><span class="pre">PyByteArray_Size()</span></code></a>.</p>
165
 
</dd></dl>
166
 
 
167
 
</div>
168
 
</div>
169
 
 
170
 
 
171
 
          </div>
172
 
        </div>
173
 
      </div>
174
 
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
175
 
        <div class="sphinxsidebarwrapper">
176
 
  <h3><a href="../contents.html">Table Of Contents</a></h3>
177
 
  <ul>
178
 
<li><a class="reference internal" href="#">Byte Array Objects</a><ul>
179
 
<li><a class="reference internal" href="#type-check-macros">Type check macros</a></li>
180
 
<li><a class="reference internal" href="#direct-api-functions">Direct API functions</a></li>
181
 
<li><a class="reference internal" href="#macros">Macros</a></li>
182
 
</ul>
183
 
</li>
184
 
</ul>
185
 
 
186
 
  <h4>Previous topic</h4>
187
 
  <p class="topless"><a href="bytes.html"
188
 
                        title="previous chapter">Bytes Objects</a></p>
189
 
  <h4>Next topic</h4>
190
 
  <p class="topless"><a href="unicode.html"
191
 
                        title="next chapter">Unicode Objects and Codecs</a></p>
192
 
<h3>This Page</h3>
193
 
<ul class="this-page-menu">
194
 
  <li><a href="../bugs.html">Report a Bug</a></li>
195
 
  <li><a href="../_sources/c-api/bytearray.txt"
196
 
         rel="nofollow">Show Source</a></li>
197
 
</ul>
198
 
 
199
 
<div id="searchbox" style="display: none" role="search">
200
 
  <h3>Quick search</h3>
201
 
    <form class="search" action="../search.html" method="get">
202
 
      <input type="text" name="q" />
203
 
      <input type="submit" value="Go" />
204
 
      <input type="hidden" name="check_keywords" value="yes" />
205
 
      <input type="hidden" name="area" value="default" />
206
 
    </form>
207
 
    <p class="searchtip" style="font-size: 90%">
208
 
    Enter search terms or a module, class or function name.
209
 
    </p>
210
 
</div>
211
 
<script type="text/javascript">$('#searchbox').show(0);</script>
212
 
        </div>
213
 
      </div>
214
 
      <div class="clearer"></div>
215
 
    </div>  
216
 
    <div class="related" role="navigation" aria-label="related navigation">
217
 
      <h3>Navigation</h3>
218
 
      <ul>
219
 
        <li class="right" style="margin-right: 10px">
220
 
          <a href="../genindex.html" title="General Index"
221
 
             >index</a></li>
222
 
        <li class="right" >
223
 
          <a href="../py-modindex.html" title="Python Module Index"
224
 
             >modules</a> |</li>
225
 
        <li class="right" >
226
 
          <a href="unicode.html" title="Unicode Objects and Codecs"
227
 
             >next</a> |</li>
228
 
        <li class="right" >
229
 
          <a href="bytes.html" title="Bytes Objects"
230
 
             >previous</a> |</li>
231
 
        <li><img src="../_static/py.png" alt=""
232
 
                 style="vertical-align: middle; margin-top: -1px"/></li>
233
 
        <li><a href="https://www.python.org/">Python</a> &raquo;</li>
234
 
        <li>
235
 
          <span class="version_switcher_placeholder">3.5.1</span>
236
 
          <a href="../index.html">Documentation </a> &raquo;
237
 
        </li>
238
 
 
239
 
          <li class="nav-item nav-item-1"><a href="index.html" >Python/C API Reference Manual</a> &raquo;</li>
240
 
          <li class="nav-item nav-item-2"><a href="concrete.html" >Concrete Objects Layer</a> &raquo;</li> 
241
 
      </ul>
242
 
    </div>  
243
 
    <div class="footer">
244
 
    &copy; <a href="../copyright.html">Copyright</a> 1990-2016, Python Software Foundation.
245
 
    <br />
246
 
    The Python Software Foundation is a non-profit corporation.
247
 
    <a href="https://www.python.org/psf/donations/">Please donate.</a>
248
 
    <br />
249
 
    Last updated on Jan 22, 2016.
250
 
    <a href="../bugs.html">Found a bug</a>?
251
 
    <br />
252
 
    Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.3.3.
253
 
    </div>
254
 
 
255
 
  </body>
256
 
</html>
 
 
b'\\ No newline at end of file'