mirror of https://github.com/McSinyx/palace
210 lines
9.8 KiB
HTML
210 lines
9.8 KiB
HTML
|
|
|||
|
<!DOCTYPE html>
|
|||
|
|
|||
|
<html>
|
|||
|
<head>
|
|||
|
<meta charset="utf-8" />
|
|||
|
<title>File I/O Interface — palace 0.2.0 documentation</title>
|
|||
|
<link rel="stylesheet" href="../_static/alabaster.css" type="text/css" />
|
|||
|
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
|
|||
|
<script id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
|
|||
|
<script src="../_static/jquery.js"></script>
|
|||
|
<script src="../_static/underscore.js"></script>
|
|||
|
<script src="../_static/doctools.js"></script>
|
|||
|
<script src="../_static/language_data.js"></script>
|
|||
|
<link rel="index" title="Index" href="../genindex.html" />
|
|||
|
<link rel="search" title="Search" href="../search.html" />
|
|||
|
<link rel="next" title="Design Principles" href="../design.html" />
|
|||
|
<link rel="prev" title="Audio Streams" href="decoder.html" />
|
|||
|
|
|||
|
<link rel="stylesheet" href="../_static/custom.css" type="text/css" />
|
|||
|
|
|||
|
|
|||
|
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />
|
|||
|
|
|||
|
</head><body>
|
|||
|
<div class="document">
|
|||
|
|
|||
|
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
|||
|
<div class="sphinxsidebarwrapper">
|
|||
|
<h3><a href="../index.html">Table of Contents</a></h3>
|
|||
|
<ul class="current">
|
|||
|
<li class="toctree-l1"><a class="reference internal" href="../installation.html">Installation</a></li>
|
|||
|
<li class="toctree-l1"><a class="reference internal" href="../tutorial/index.html">Tutorial</a></li>
|
|||
|
<li class="toctree-l1 current"><a class="reference internal" href="index.html">Reference</a><ul class="current">
|
|||
|
<li class="toctree-l2"><a class="reference internal" href="device.html">Audio Devices</a></li>
|
|||
|
<li class="toctree-l2"><a class="reference internal" href="context.html">Audio Library Contexts</a></li>
|
|||
|
<li class="toctree-l2"><a class="reference internal" href="buffer.html">Resource Caching</a></li>
|
|||
|
<li class="toctree-l2"><a class="reference internal" href="source.html">Sources & Source Groups</a></li>
|
|||
|
<li class="toctree-l2"><a class="reference internal" href="effect.html">Environmental Effects</a></li>
|
|||
|
<li class="toctree-l2"><a class="reference internal" href="decoder.html">Audio Streams</a></li>
|
|||
|
<li class="toctree-l2 current"><a class="current reference internal" href="#">File I/O Interface</a></li>
|
|||
|
</ul>
|
|||
|
</li>
|
|||
|
<li class="toctree-l1"><a class="reference internal" href="../design.html">Design Principles</a></li>
|
|||
|
<li class="toctree-l1"><a class="reference internal" href="../contributing.html">Getting Involved</a></li>
|
|||
|
<li class="toctree-l1"><a class="reference internal" href="../copying.html">Copying</a></li>
|
|||
|
</ul>
|
|||
|
<h3>Quick Navigation</h3>
|
|||
|
<ul>
|
|||
|
<li class="toctree-l1">
|
|||
|
<a class="reference external" href="https://pypi.org/project/palace/">
|
|||
|
Python Package Index
|
|||
|
</a>
|
|||
|
</li>
|
|||
|
<li class="toctree-l1">
|
|||
|
<a class="reference external"
|
|||
|
href="https://travis-ci.com/github/McSinyx/palace">
|
|||
|
Travis CI Build
|
|||
|
</a>
|
|||
|
</li>
|
|||
|
<li class="toctree-l1">
|
|||
|
<a class="reference external"
|
|||
|
href="https://ci.appveyor.com/project/McSinyx/palace">
|
|||
|
AppVeyor Build
|
|||
|
</a>
|
|||
|
</li>
|
|||
|
<li class="toctree-l1">
|
|||
|
<a class="reference external" href="https://github.com/McSinyx/palace">
|
|||
|
GitHub Repository
|
|||
|
</a>
|
|||
|
</li>
|
|||
|
<li class="toctree-l1">
|
|||
|
<a class="reference external"
|
|||
|
href="https://matrix.to/#/#palace-dev:matrix.org">
|
|||
|
Matrix Chat Room
|
|||
|
</a>
|
|||
|
</li>
|
|||
|
</ul>
|
|||
|
<div id="searchbox" style="display: none" role="search">
|
|||
|
<h3 id="searchlabel">Quick search</h3>
|
|||
|
<div class="searchformwrapper">
|
|||
|
<form class="search" action="../search.html" method="get">
|
|||
|
<input type="text" name="q" aria-labelledby="searchlabel" />
|
|||
|
<input type="submit" value="Go" />
|
|||
|
</form>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<script>$('#searchbox').show(0);</script>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<div class="documentwrapper">
|
|||
|
<div class="bodywrapper">
|
|||
|
<div class="related top">
|
|||
|
|
|||
|
<nav id="rellinks">
|
|||
|
<ul>
|
|||
|
<li>
|
|||
|
←
|
|||
|
<a href="decoder.html" title="Previous document">Audio Streams</a>
|
|||
|
</li>
|
|||
|
<li>
|
|||
|
<a href="../design.html" title="Next document">Design Principles</a>
|
|||
|
→
|
|||
|
</li>
|
|||
|
</ul>
|
|||
|
</nav>
|
|||
|
</div>
|
|||
|
|
|||
|
|
|||
|
<div class="body" role="main">
|
|||
|
|
|||
|
<div class="section" id="file-i-o-interface">
|
|||
|
<h1>File I/O Interface<a class="headerlink" href="#file-i-o-interface" title="Permalink to this headline">¶</a></h1>
|
|||
|
<dl class="py function">
|
|||
|
<dt id="palace.current_fileio">
|
|||
|
<code class="sig-prename descclassname">palace.</code><code class="sig-name descname">current_fileio</code><span class="sig-paren">(</span><span class="sig-paren">)</span> → Optional<span class="p">[</span>Callable<span class="p">[</span><span class="p">[</span>str<span class="p">]</span><span class="p">, </span><a class="reference internal" href="#palace.FileIO" title="palace.FileIO">palace.FileIO</a><span class="p">]</span><span class="p">]</span><a class="headerlink" href="#palace.current_fileio" title="Permalink to this definition">¶</a></dt>
|
|||
|
<dd><p>Return the file I/O factory currently in used by audio decoders.</p>
|
|||
|
<p>If the default is being used, return <cite>None</cite>.</p>
|
|||
|
</dd></dl>
|
|||
|
|
|||
|
<dl class="py function">
|
|||
|
<dt id="palace.use_fileio">
|
|||
|
<code class="sig-prename descclassname">palace.</code><code class="sig-name descname">use_fileio</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">factory</span><span class="p">:</span> <span class="n">Optional<span class="p">[</span>Callable<span class="p">[</span><span class="p">[</span>str<span class="p">]</span><span class="p">, </span>FileIO<span class="p">]</span><span class="p">]</span></span></em>, <em class="sig-param"><span class="n">buffer_size</span><span class="p">:</span> <span class="n">int</span> <span class="o">=</span> <span class="default_value">8192</span></em><span class="sig-paren">)</span> → None<a class="headerlink" href="#palace.use_fileio" title="Permalink to this definition">¶</a></dt>
|
|||
|
<dd><p>Set the file I/O factory instance to be used by audio decoders.</p>
|
|||
|
<p>If <cite>factory=None</cite> is provided, revert to the default.</p>
|
|||
|
</dd></dl>
|
|||
|
|
|||
|
<dl class="py class">
|
|||
|
<dt id="palace.FileIO">
|
|||
|
<em class="property">class </em><code class="sig-prename descclassname">palace.</code><code class="sig-name descname">FileIO</code><span class="sig-paren">(</span><em class="sig-param"><span class="o">*</span><span class="n">args</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="headerlink" href="#palace.FileIO" title="Permalink to this definition">¶</a></dt>
|
|||
|
<dd><p>File I/O protocol.</p>
|
|||
|
<p>This static duck type defines methods required to be used by
|
|||
|
palace decoders. Despite its name, a <cite>FileIO</cite> is not necessarily
|
|||
|
created from a file, but any seekable finite input stream.</p>
|
|||
|
<p>Many classes defined in the standard library module <cite>io</cite>
|
|||
|
are compatible with this protocol.</p>
|
|||
|
<p class="rubric">Notes</p>
|
|||
|
<p>Since PEP 544 is only implemented in Python 3.8+, type checking
|
|||
|
for this on earlier Python version might not work as expected.</p>
|
|||
|
<dl class="py method">
|
|||
|
<dt id="palace.FileIO.close">
|
|||
|
<em class="property">abstract </em><code class="sig-name descname">close</code><span class="sig-paren">(</span><span class="sig-paren">)</span> → None<a class="headerlink" href="#palace.FileIO.close" title="Permalink to this definition">¶</a></dt>
|
|||
|
<dd><p>Close the file.</p>
|
|||
|
</dd></dl>
|
|||
|
|
|||
|
<dl class="py method">
|
|||
|
<dt id="palace.FileIO.read">
|
|||
|
<em class="property">abstract </em><code class="sig-name descname">read</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">size</span><span class="p">:</span> <span class="n">int</span></em><span class="sig-paren">)</span> → bytes<a class="headerlink" href="#palace.FileIO.read" title="Permalink to this definition">¶</a></dt>
|
|||
|
<dd><p>Read at most size bytes, returned as bytes.</p>
|
|||
|
</dd></dl>
|
|||
|
|
|||
|
<dl class="py method">
|
|||
|
<dt id="palace.FileIO.seek">
|
|||
|
<em class="property">abstract </em><code class="sig-name descname">seek</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">offset</span><span class="p">:</span> <span class="n">int</span></em>, <em class="sig-param"><span class="n">whence</span><span class="p">:</span> <span class="n">int</span> <span class="o">=</span> <span class="default_value">0</span></em><span class="sig-paren">)</span> → int<a class="headerlink" href="#palace.FileIO.seek" title="Permalink to this definition">¶</a></dt>
|
|||
|
<dd><p>Move to new file position and return the file position.</p>
|
|||
|
<dl class="field-list simple">
|
|||
|
<dt class="field-odd">Parameters</dt>
|
|||
|
<dd class="field-odd"><ul class="simple">
|
|||
|
<li><p><strong>offset</strong> (<em>int</em>) – A byte count.</p></li>
|
|||
|
<li><p><strong>whence</strong> (<em>int</em><em>, </em><em>optional</em>) – Either 0 (default, move relative to start of file),
|
|||
|
1 (move relative to current position)
|
|||
|
or 2 (move relative to end of file).</p></li>
|
|||
|
</ul>
|
|||
|
</dd>
|
|||
|
</dl>
|
|||
|
</dd></dl>
|
|||
|
|
|||
|
</dd></dl>
|
|||
|
|
|||
|
</div>
|
|||
|
|
|||
|
|
|||
|
</div>
|
|||
|
<div class="related bottom">
|
|||
|
|
|||
|
<nav id="rellinks">
|
|||
|
<ul>
|
|||
|
<li>
|
|||
|
←
|
|||
|
<a href="decoder.html" title="Previous document">Audio Streams</a>
|
|||
|
</li>
|
|||
|
<li>
|
|||
|
<a href="../design.html" title="Next document">Design Principles</a>
|
|||
|
→
|
|||
|
</li>
|
|||
|
</ul>
|
|||
|
</nav>
|
|||
|
</div>
|
|||
|
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<div class="clearer"></div>
|
|||
|
</div>
|
|||
|
<div class="footer">
|
|||
|
©2019, 2020 Nguyễn Gia Phong et al.
|
|||
|
|
|||
|
|
|
|||
|
Powered by <a href="http://sphinx-doc.org/">Sphinx 3.0.3</a>
|
|||
|
& <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|
|||
|
|
|||
|
|
|
|||
|
<a href="../_sources/reference/file-io.rst.txt"
|
|||
|
rel="nofollow">Page source</a>
|
|||
|
</div>
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
</body>
|
|||
|
</html>
|