shaka-packager/docs/d3/d73/classshaka_1_1File.html

1057 lines
56 KiB
HTML
Raw Permalink Normal View History

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
2021-06-22 00:16:40 +00:00
<meta name="generator" content="Doxygen 1.8.17"/>
2018-02-10 23:37:42 +00:00
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Shaka Packager SDK: shaka::File Class Reference</title>
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../jquery.js"></script>
<script type="text/javascript" src="../../dynsections.js"></script>
<link href="../../search/search.css" rel="stylesheet" type="text/css"/>
2018-02-10 23:37:42 +00:00
<script type="text/javascript" src="../../search/searchdata.js"></script>
<script type="text/javascript" src="../../search/search.js"></script>
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
2018-02-10 23:37:42 +00:00
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">Shaka Packager SDK
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
2021-06-22 00:16:40 +00:00
<!-- Generated by Doxygen 1.8.17 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
2021-06-22 00:16:40 +00:00
var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
/* @license-end */
</script>
2018-02-10 23:37:42 +00:00
<script type="text/javascript" src="../../menudata.js"></script>
<script type="text/javascript" src="../../menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
2018-02-10 23:37:42 +00:00
$(function() {
initMenu('../../',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
2018-02-10 23:37:42 +00:00
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
2018-02-10 23:37:42 +00:00
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="../../d8/daf/namespaceshaka.html">shaka</a></li><li class="navelem"><a class="el" href="../../d3/d73/classshaka_1_1File.html">File</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pub-static-methods">Static Public Member Functions</a> &#124;
<a href="#pro-methods">Protected Member Functions</a> &#124;
<a href="#friends">Friends</a> &#124;
<a href="../../d5/dfe/classshaka_1_1File-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">shaka::File Class Reference<span class="mlabels"><span class="mlabel">abstract</span></span></div> </div>
</div><!--header-->
<div class="contents">
<p>Define an abstract file interface.
<a href="../../d3/d73/classshaka_1_1File.html#details">More...</a></p>
<p><code>#include &lt;<a class="el" href="../../d2/d4d/file_8h_source.html">file.h</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for shaka::File:</div>
<div class="dyncontent">
<div class="center">
<img src="../../d3/d73/classshaka_1_1File.png" usemap="#shaka::File_map" alt=""/>
<map id="shaka::File_map" name="shaka::File_map">
<area href="../../dd/d40/classshaka_1_1CallbackFile.html" alt="shaka::CallbackFile" shape="rect" coords="0,56,136,80"/>
<area href="../../d1/dc7/classshaka_1_1HttpFile.html" alt="shaka::HttpFile" shape="rect" coords="146,56,282,80"/>
<area href="../../d7/dbd/classshaka_1_1LocalFile.html" title="Implement LocalFile which deals with local storage." alt="shaka::LocalFile" shape="rect" coords="292,56,428,80"/>
<area href="../../de/dad/classshaka_1_1MemoryFile.html" alt="shaka::MemoryFile" shape="rect" coords="438,56,574,80"/>
<area href="../../dd/d0c/classshaka_1_1ThreadedIoFile.html" title="Declaration of class which implements a thread-safe circular buffer." alt="shaka::ThreadedIoFile" shape="rect" coords="584,56,720,80"/>
<area href="../../d4/dcb/classshaka_1_1UdpFile.html" title="Implements UdpFile, which receives UDP unicast and multicast streams." alt="shaka::UdpFile" shape="rect" coords="730,56,866,80"/>
</map>
</div></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a932666ed1d6a565bf387a9d8b39a8948"><td class="memItemLeft" align="right" valign="top">virtual bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d3/d73/classshaka_1_1File.html#a932666ed1d6a565bf387a9d8b39a8948">Close</a> ()=0</td></tr>
<tr class="separator:a932666ed1d6a565bf387a9d8b39a8948"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6e1ecb2904b609554d332290f20fde0a"><td class="memItemLeft" align="right" valign="top">virtual int64_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d3/d73/classshaka_1_1File.html#a6e1ecb2904b609554d332290f20fde0a">Read</a> (void *buffer, uint64_t length)=0</td></tr>
<tr class="separator:a6e1ecb2904b609554d332290f20fde0a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8c498531ecbd205fceb0be3478361801"><td class="memItemLeft" align="right" valign="top">virtual int64_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d3/d73/classshaka_1_1File.html#a8c498531ecbd205fceb0be3478361801">Write</a> (const void *buffer, uint64_t length)=0</td></tr>
<tr class="separator:a8c498531ecbd205fceb0be3478361801"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aeb98b64a05f141140e110170bef1bc55"><td class="memItemLeft" align="right" valign="top">virtual int64_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d3/d73/classshaka_1_1File.html#aeb98b64a05f141140e110170bef1bc55">Size</a> ()=0</td></tr>
<tr class="separator:aeb98b64a05f141140e110170bef1bc55"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5fa625751e03b9e7652ba1bfa98b8ca4"><td class="memItemLeft" align="right" valign="top">virtual bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d3/d73/classshaka_1_1File.html#a5fa625751e03b9e7652ba1bfa98b8ca4">Flush</a> ()=0</td></tr>
<tr class="separator:a5fa625751e03b9e7652ba1bfa98b8ca4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a486bda715b58b1a1863fbfc8d48da62a"><td class="memItemLeft" align="right" valign="top">virtual bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d3/d73/classshaka_1_1File.html#a486bda715b58b1a1863fbfc8d48da62a">Seek</a> (uint64_t position)=0</td></tr>
<tr class="separator:a486bda715b58b1a1863fbfc8d48da62a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a07ae6476e88dab6c0cd9d8c0073b667d"><td class="memItemLeft" align="right" valign="top">virtual bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d3/d73/classshaka_1_1File.html#a07ae6476e88dab6c0cd9d8c0073b667d">Tell</a> (uint64_t *position)=0</td></tr>
<tr class="separator:a07ae6476e88dab6c0cd9d8c0073b667d"><td class="memSeparator" colspan="2">&#160;</td></tr>
2018-02-10 23:37:42 +00:00
<tr class="memitem:a4b06e08bb0295cb89fca45f9356ecbae"><td class="memItemLeft" align="right" valign="top">const std::string &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d3/d73/classshaka_1_1File.html#a4b06e08bb0295cb89fca45f9356ecbae">file_name</a> () const</td></tr>
<tr class="separator:a4b06e08bb0295cb89fca45f9356ecbae"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-methods"></a>
Static Public Member Functions</h2></td></tr>
2018-02-10 23:37:42 +00:00
<tr class="memitem:ac7b5143f9b8c3e786762fe4ada2b8dcf"><td class="memItemLeft" align="right" valign="top">static <a class="el" href="../../d3/d73/classshaka_1_1File.html">File</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d3/d73/classshaka_1_1File.html#ac7b5143f9b8c3e786762fe4ada2b8dcf">Open</a> (const char *<a class="el" href="../../d3/d73/classshaka_1_1File.html#a4b06e08bb0295cb89fca45f9356ecbae">file_name</a>, const char *mode)</td></tr>
<tr class="separator:ac7b5143f9b8c3e786762fe4ada2b8dcf"><td class="memSeparator" colspan="2">&#160;</td></tr>
2018-02-10 23:37:42 +00:00
<tr class="memitem:a0a50526352bd6e946c4f33d3e8431b2d"><td class="memItemLeft" align="right" valign="top">static <a class="el" href="../../d3/d73/classshaka_1_1File.html">File</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d3/d73/classshaka_1_1File.html#a0a50526352bd6e946c4f33d3e8431b2d">OpenWithNoBuffering</a> (const char *<a class="el" href="../../d3/d73/classshaka_1_1File.html#a4b06e08bb0295cb89fca45f9356ecbae">file_name</a>, const char *mode)</td></tr>
<tr class="separator:a0a50526352bd6e946c4f33d3e8431b2d"><td class="memSeparator" colspan="2">&#160;</td></tr>
2018-02-10 23:37:42 +00:00
<tr class="memitem:a383c9f670511961f334569fd1a7a103b"><td class="memItemLeft" align="right" valign="top">static bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d3/d73/classshaka_1_1File.html#a383c9f670511961f334569fd1a7a103b">Delete</a> (const char *<a class="el" href="../../d3/d73/classshaka_1_1File.html#a4b06e08bb0295cb89fca45f9356ecbae">file_name</a>)</td></tr>
<tr class="separator:a383c9f670511961f334569fd1a7a103b"><td class="memSeparator" colspan="2">&#160;</td></tr>
2018-02-10 23:37:42 +00:00
<tr class="memitem:ac978d5c0585850d4d9948fdf39b33292"><td class="memItemLeft" align="right" valign="top">static int64_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d3/d73/classshaka_1_1File.html#ac978d5c0585850d4d9948fdf39b33292">GetFileSize</a> (const char *<a class="el" href="../../d3/d73/classshaka_1_1File.html#a4b06e08bb0295cb89fca45f9356ecbae">file_name</a>)</td></tr>
<tr class="separator:ac978d5c0585850d4d9948fdf39b33292"><td class="memSeparator" colspan="2">&#160;</td></tr>
2018-02-10 23:37:42 +00:00
<tr class="memitem:ac9a19cb5fc45664ca440996bf1201c30"><td class="memItemLeft" align="right" valign="top">static bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d3/d73/classshaka_1_1File.html#ac9a19cb5fc45664ca440996bf1201c30">ReadFileToString</a> (const char *<a class="el" href="../../d3/d73/classshaka_1_1File.html#a4b06e08bb0295cb89fca45f9356ecbae">file_name</a>, std::string *contents)</td></tr>
<tr class="separator:ac9a19cb5fc45664ca440996bf1201c30"><td class="memSeparator" colspan="2">&#160;</td></tr>
2018-02-10 23:37:42 +00:00
<tr class="memitem:a483ce187d628385d342748315d72f8ab"><td class="memItemLeft" align="right" valign="top">static bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d3/d73/classshaka_1_1File.html#a483ce187d628385d342748315d72f8ab">WriteStringToFile</a> (const char *<a class="el" href="../../d3/d73/classshaka_1_1File.html#a4b06e08bb0295cb89fca45f9356ecbae">file_name</a>, const std::string &amp;contents)</td></tr>
<tr class="separator:a483ce187d628385d342748315d72f8ab"><td class="memSeparator" colspan="2">&#160;</td></tr>
2018-02-10 23:37:42 +00:00
<tr class="memitem:a4b5280fe058359b5991037f90dde2b77"><td class="memItemLeft" align="right" valign="top">static bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d3/d73/classshaka_1_1File.html#a4b5280fe058359b5991037f90dde2b77">WriteFileAtomically</a> (const char *<a class="el" href="../../d3/d73/classshaka_1_1File.html#a4b06e08bb0295cb89fca45f9356ecbae">file_name</a>, const std::string &amp;contents)</td></tr>
<tr class="separator:a4b5280fe058359b5991037f90dde2b77"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af2cbec5c6dc1c97ada010acd83b9728a"><td class="memItemLeft" align="right" valign="top">static bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d3/d73/classshaka_1_1File.html#af2cbec5c6dc1c97ada010acd83b9728a">Copy</a> (const char *from_file_name, const char *to_file_name)</td></tr>
<tr class="separator:af2cbec5c6dc1c97ada010acd83b9728a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a85633ec9f051eb9f32b07ff7e7740d1c"><td class="memItemLeft" align="right" valign="top">static int64_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d3/d73/classshaka_1_1File.html#a85633ec9f051eb9f32b07ff7e7740d1c">CopyFile</a> (<a class="el" href="../../d3/d73/classshaka_1_1File.html">File</a> *source, <a class="el" href="../../d3/d73/classshaka_1_1File.html">File</a> *destination)</td></tr>
<tr class="separator:a85633ec9f051eb9f32b07ff7e7740d1c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a07e2d2f98597320f71fb96dff74cfcb2"><td class="memItemLeft" align="right" valign="top">static int64_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d3/d73/classshaka_1_1File.html#a07e2d2f98597320f71fb96dff74cfcb2">CopyFile</a> (<a class="el" href="../../d3/d73/classshaka_1_1File.html">File</a> *source, <a class="el" href="../../d3/d73/classshaka_1_1File.html">File</a> *destination, int64_t max_copy)</td></tr>
<tr class="separator:a07e2d2f98597320f71fb96dff74cfcb2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8eb71689f5456ba0b1a401c57386caaf"><td class="memItemLeft" align="right" valign="top">static bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d3/d73/classshaka_1_1File.html#a8eb71689f5456ba0b1a401c57386caaf">IsLocalRegularFile</a> (const char *<a class="el" href="../../d3/d73/classshaka_1_1File.html#a4b06e08bb0295cb89fca45f9356ecbae">file_name</a>)</td></tr>
<tr class="separator:a8eb71689f5456ba0b1a401c57386caaf"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7a90ebd27f7728a7075cf3ba97396cae"><td class="memItemLeft" align="right" valign="top">static std::string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d3/d73/classshaka_1_1File.html#a7a90ebd27f7728a7075cf3ba97396cae">MakeCallbackFileName</a> (const <a class="el" href="../../d9/da8/structshaka_1_1BufferCallbackParams.html">BufferCallbackParams</a> &amp;callback_params, const std::string &amp;name)</td></tr>
<tr class="separator:a7a90ebd27f7728a7075cf3ba97396cae"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae87642f9661588e47479721cd101bf7d"><td class="memItemLeft" align="right" valign="top">static bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d3/d73/classshaka_1_1File.html#ae87642f9661588e47479721cd101bf7d">ParseCallbackFileName</a> (const std::string &amp;callback_file_name, const <a class="el" href="../../d9/da8/structshaka_1_1BufferCallbackParams.html">BufferCallbackParams</a> **callback_params, std::string *name)</td></tr>
<tr class="separator:ae87642f9661588e47479721cd101bf7d"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-methods"></a>
Protected Member Functions</h2></td></tr>
2018-02-10 23:37:42 +00:00
<tr class="memitem:a33ead01d4090de618937d4e989a9f27f"><td class="memItemLeft" align="right" valign="top"><a id="a33ead01d4090de618937d4e989a9f27f"></a>
&#160;</td><td class="memItemRight" valign="bottom"><b>File</b> (const std::string &amp;<a class="el" href="../../d3/d73/classshaka_1_1File.html#a4b06e08bb0295cb89fca45f9356ecbae">file_name</a>)</td></tr>
<tr class="separator:a33ead01d4090de618937d4e989a9f27f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a92d1a67d1560a5290eb36447c50fabf9"><td class="memItemLeft" align="right" valign="top">virtual&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d3/d73/classshaka_1_1File.html#a92d1a67d1560a5290eb36447c50fabf9">~File</a> ()</td></tr>
<tr class="separator:a92d1a67d1560a5290eb36447c50fabf9"><td class="memSeparator" colspan="2">&#160;</td></tr>
2018-02-10 23:37:42 +00:00
<tr class="memitem:a68a15f623c2a1601879f291f93a1f464"><td class="memItemLeft" align="right" valign="top"><a id="a68a15f623c2a1601879f291f93a1f464"></a>
virtual bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d3/d73/classshaka_1_1File.html#a68a15f623c2a1601879f291f93a1f464">Open</a> ()=0</td></tr>
2018-02-10 23:37:42 +00:00
<tr class="memdesc:a68a15f623c2a1601879f291f93a1f464"><td class="mdescLeft">&#160;</td><td class="mdescRight">Internal open. Should not be used directly. <br /></td></tr>
<tr class="separator:a68a15f623c2a1601879f291f93a1f464"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="friends"></a>
Friends</h2></td></tr>
2018-02-10 23:37:42 +00:00
<tr class="memitem:a9bc31f0290fe6edb8a0e3f9b61825325"><td class="memItemLeft" align="right" valign="top"><a id="a9bc31f0290fe6edb8a0e3f9b61825325"></a>
class&#160;</td><td class="memItemRight" valign="bottom"><b>ThreadedIoFile</b></td></tr>
<tr class="separator:a9bc31f0290fe6edb8a0e3f9b61825325"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Define an abstract file interface. </p>
2021-06-22 00:16:40 +00:00
<p class="definition">Definition at line <a class="el" href="../../d2/d4d/file_8h_source.html#l00028">28</a> of file <a class="el" href="../../d2/d4d/file_8h_source.html">file.h</a>.</p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
2018-02-10 23:37:42 +00:00
<a id="a92d1a67d1560a5290eb36447c50fabf9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a92d1a67d1560a5290eb36447c50fabf9">&#9670;&nbsp;</a></span>~File()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">virtual shaka::File::~File </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">protected</span><span class="mlabel">virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Do <em>not</em> call the destructor directly (with the "delete" keyword) nor use std::unique_ptr; instead use <a class="el" href="../../d3/d73/classshaka_1_1File.html#a932666ed1d6a565bf387a9d8b39a8948">Close()</a>. </p>
2021-06-22 00:16:40 +00:00
<p class="definition">Definition at line <a class="el" href="../../d2/d4d/file_8h_source.html#l00176">176</a> of file <a class="el" href="../../d2/d4d/file_8h_source.html">file.h</a>.</p>
</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
2018-02-10 23:37:42 +00:00
<a id="a932666ed1d6a565bf387a9d8b39a8948"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a932666ed1d6a565bf387a9d8b39a8948">&#9670;&nbsp;</a></span>Close()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">virtual bool shaka::File::Close </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">pure virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p><a class="el" href="../../d3/d73/classshaka_1_1File.html#a5fa625751e03b9e7652ba1bfa98b8ca4">Flush()</a> and de-allocate resources associated with this file, and delete this <a class="el" href="../../d3/d73/classshaka_1_1File.html" title="Define an abstract file interface.">File</a> object. THIS IS THE ONE TRUE WAY TO DEALLOCATE THIS OBJECT. </p><dl class="section return"><dt>Returns</dt><dd>true on success. For writable files, returning false MAY INDICATE DATA LOSS. </dd></dl>
2021-06-22 00:16:40 +00:00
<p>Implemented in <a class="el" href="../../d1/dc7/classshaka_1_1HttpFile.html#a3fba23d4dc1f8ad1d92d2e2de377e1f6">shaka::HttpFile</a>, <a class="el" href="../../d4/dcb/classshaka_1_1UdpFile.html#a61cdb937b3a996bb8b054679d98df812">shaka::UdpFile</a>, <a class="el" href="../../dd/d0c/classshaka_1_1ThreadedIoFile.html#a79292b93c39f609b5348787a39fc77b2">shaka::ThreadedIoFile</a>, <a class="el" href="../../d7/dbd/classshaka_1_1LocalFile.html#a3d881c251c19a36eaf50483971095370">shaka::LocalFile</a>, <a class="el" href="../../de/dad/classshaka_1_1MemoryFile.html#a4cfe38684f4fdde650a2ed7fdc780f05">shaka::MemoryFile</a>, and <a class="el" href="../../dd/d40/classshaka_1_1CallbackFile.html#aac23ef04e5bafef7d5b4c5d7a3fcfbb5">shaka::CallbackFile</a>.</p>
</div>
</div>
2018-02-10 23:37:42 +00:00
<a id="af2cbec5c6dc1c97ada010acd83b9728a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af2cbec5c6dc1c97ada010acd83b9728a">&#9670;&nbsp;</a></span>Copy()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">bool shaka::File::Copy </td>
<td>(</td>
<td class="paramtype">const char *&#160;</td>
<td class="paramname"><em>from_file_name</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char *&#160;</td>
<td class="paramname"><em>to_file_name</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
2018-02-10 23:37:42 +00:00
<p>Copies files. This is not good for copying huge files. Although not recommended, it is safe to have source file and destination file name be the same. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">from_file_name</td><td>is the source file name. </td></tr>
<tr><td class="paramname">to_file_name</td><td>is the destination file name. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true on success, false otherwise. </dd></dl>
<p class="definition">Definition at line <a class="el" href="../../d5/dfc/file_8cc_source.html#l00300">300</a> of file <a class="el" href="../../d5/dfc/file_8cc_source.html">file.cc</a>.</p>
</div>
</div>
2018-02-10 23:37:42 +00:00
<a id="a85633ec9f051eb9f32b07ff7e7740d1c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a85633ec9f051eb9f32b07ff7e7740d1c">&#9670;&nbsp;</a></span>CopyFile() <span class="overload">[1/2]</span></h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">int64_t shaka::File::CopyFile </td>
<td>(</td>
<td class="paramtype"><a class="el" href="../../d3/d73/classshaka_1_1File.html">File</a> *&#160;</td>
<td class="paramname"><em>source</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="../../d3/d73/classshaka_1_1File.html">File</a> *&#160;</td>
<td class="paramname"><em>destination</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
2018-02-10 23:37:42 +00:00
<p>Copies the contents from source to destination. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">source</td><td>The file to copy from. </td></tr>
<tr><td class="paramname">destination</td><td>The file to copy to. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Number of bytes written, or a value &lt; 0 on error. </dd></dl>
<p class="definition">Definition at line <a class="el" href="../../d5/dfc/file_8cc_source.html#l00336">336</a> of file <a class="el" href="../../d5/dfc/file_8cc_source.html">file.cc</a>.</p>
</div>
</div>
2018-02-10 23:37:42 +00:00
<a id="a07e2d2f98597320f71fb96dff74cfcb2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a07e2d2f98597320f71fb96dff74cfcb2">&#9670;&nbsp;</a></span>CopyFile() <span class="overload">[2/2]</span></h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">int64_t shaka::File::CopyFile </td>
<td>(</td>
<td class="paramtype"><a class="el" href="../../d3/d73/classshaka_1_1File.html">File</a> *&#160;</td>
<td class="paramname"><em>source</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="../../d3/d73/classshaka_1_1File.html">File</a> *&#160;</td>
<td class="paramname"><em>destination</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int64_t&#160;</td>
<td class="paramname"><em>max_copy</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
2018-02-10 23:37:42 +00:00
<p>Copies the contents from source to destination. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">source</td><td>The file to copy from. </td></tr>
<tr><td class="paramname">destination</td><td>The file to copy to. </td></tr>
<tr><td class="paramname">max_copy</td><td>The maximum number of bytes to copy; &lt; 0 to copy to EOF. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Number of bytes written, or a value &lt; 0 on error. </dd></dl>
<p class="definition">Definition at line <a class="el" href="../../d5/dfc/file_8cc_source.html#l00340">340</a> of file <a class="el" href="../../d5/dfc/file_8cc_source.html">file.cc</a>.</p>
</div>
</div>
2018-02-10 23:37:42 +00:00
<a id="a383c9f670511961f334569fd1a7a103b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a383c9f670511961f334569fd1a7a103b">&#9670;&nbsp;</a></span>Delete()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">bool shaka::File::Delete </td>
<td>(</td>
<td class="paramtype">const char *&#160;</td>
<td class="paramname"><em>file_name</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
2018-02-10 23:37:42 +00:00
<p>Delete the specified file. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">file_name</td><td>contains the path of the file to be deleted. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true if successful, false otherwise. </dd></dl>
<p class="definition">Definition at line <a class="el" href="../../d5/dfc/file_8cc_source.html#l00212">212</a> of file <a class="el" href="../../d5/dfc/file_8cc_source.html">file.cc</a>.</p>
</div>
</div>
2018-02-10 23:37:42 +00:00
<a id="a4b06e08bb0295cb89fca45f9356ecbae"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4b06e08bb0295cb89fca45f9356ecbae">&#9670;&nbsp;</a></span>file_name()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">const std::string&amp; shaka::File::file_name </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<dl class="section return"><dt>Returns</dt><dd>The file name. Note that the file type prefix has been stripped off. </dd></dl>
2021-06-22 00:16:40 +00:00
<p class="definition">Definition at line <a class="el" href="../../d2/d4d/file_8h_source.html#l00096">96</a> of file <a class="el" href="../../d2/d4d/file_8h_source.html">file.h</a>.</p>
</div>
</div>
2018-02-10 23:37:42 +00:00
<a id="a5fa625751e03b9e7652ba1bfa98b8ca4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5fa625751e03b9e7652ba1bfa98b8ca4">&#9670;&nbsp;</a></span>Flush()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">virtual bool shaka::File::Flush </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">pure virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Flush the file so that recently written data will survive an application crash (but not necessarily an OS crash). For instance, in <a class="el" href="../../d7/dbd/classshaka_1_1LocalFile.html" title="Implement LocalFile which deals with local storage.">LocalFile</a> the data is flushed into the OS but not necessarily to disk. </p><dl class="section return"><dt>Returns</dt><dd>true on success, false otherwise. </dd></dl>
2021-06-22 00:16:40 +00:00
<p>Implemented in <a class="el" href="../../d1/dc7/classshaka_1_1HttpFile.html#ad032c195629f85f8725192443518efd3">shaka::HttpFile</a>, <a class="el" href="../../d4/dcb/classshaka_1_1UdpFile.html#a4b5430ec1d24434f5f6d9b20692efbc2">shaka::UdpFile</a>, <a class="el" href="../../dd/d0c/classshaka_1_1ThreadedIoFile.html#a2b53b72d99aad4439781e3887492452c">shaka::ThreadedIoFile</a>, <a class="el" href="../../d7/dbd/classshaka_1_1LocalFile.html#a04b4523a7352572b2c6d72f1d6f3a077">shaka::LocalFile</a>, <a class="el" href="../../de/dad/classshaka_1_1MemoryFile.html#aecf76d1658ea5f088ef1e42f04b9b64d">shaka::MemoryFile</a>, and <a class="el" href="../../dd/d40/classshaka_1_1CallbackFile.html#aef34f60f2e94f862e495c254edc58bd9">shaka::CallbackFile</a>.</p>
</div>
</div>
2018-02-10 23:37:42 +00:00
<a id="ac978d5c0585850d4d9948fdf39b33292"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac978d5c0585850d4d9948fdf39b33292">&#9670;&nbsp;</a></span>GetFileSize()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">int64_t shaka::File::GetFileSize </td>
<td>(</td>
<td class="paramtype">const char *&#160;</td>
<td class="paramname"><em>file_name</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<dl class="section return"><dt>Returns</dt><dd>The size of a file in bytes on success, a value &lt; 0 otherwise. The file will be opened and closed in the process. </dd></dl>
<p class="definition">Definition at line <a class="el" href="../../d5/dfc/file_8cc_source.html#l00221">221</a> of file <a class="el" href="../../d5/dfc/file_8cc_source.html">file.cc</a>.</p>
</div>
</div>
<a id="a8eb71689f5456ba0b1a401c57386caaf"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8eb71689f5456ba0b1a401c57386caaf">&#9670;&nbsp;</a></span>IsLocalRegularFile()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">bool shaka::File::IsLocalRegularFile </td>
<td>(</td>
<td class="paramtype">const char *&#160;</td>
<td class="paramname"><em>file_name</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">file_name</td><td>is the name of the file to be checked. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true if <code>file_name</code> is a local and regular file. </dd></dl>
<p class="definition">Definition at line <a class="el" href="../../d5/dfc/file_8cc_source.html#l00377">377</a> of file <a class="el" href="../../d5/dfc/file_8cc_source.html">file.cc</a>.</p>
</div>
</div>
2018-02-10 23:37:42 +00:00
<a id="a7a90ebd27f7728a7075cf3ba97396cae"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7a90ebd27f7728a7075cf3ba97396cae">&#9670;&nbsp;</a></span>MakeCallbackFileName()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">std::string shaka::File::MakeCallbackFileName </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="../../d9/da8/structshaka_1_1BufferCallbackParams.html">BufferCallbackParams</a> &amp;&#160;</td>
<td class="paramname"><em>callback_params</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const std::string &amp;&#160;</td>
<td class="paramname"><em>name</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
2018-02-10 23:37:42 +00:00
<p>Generate callback file name. NOTE: THE GENERATED NAME IS ONLY VAID WHILE <em>callback_params</em> IS VALID. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">callback_params</td><td>references <a class="el" href="../../d9/da8/structshaka_1_1BufferCallbackParams.html" title="Buffer callback params.">BufferCallbackParams</a>, which will be embedded in the generated callback file name. </td></tr>
<tr><td class="paramname">name</td><td>is the name of the buffer, which will be embedded in the generated callback file name. </td></tr>
</table>
</dd>
</dl>
<p class="definition">Definition at line <a class="el" href="../../d5/dfc/file_8cc_source.html#l00402">402</a> of file <a class="el" href="../../d5/dfc/file_8cc_source.html">file.cc</a>.</p>
</div>
</div>
2018-02-10 23:37:42 +00:00
<a id="ac7b5143f9b8c3e786762fe4ada2b8dcf"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac7b5143f9b8c3e786762fe4ada2b8dcf">&#9670;&nbsp;</a></span>Open()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="../../d3/d73/classshaka_1_1File.html">File</a> * shaka::File::Open </td>
<td>(</td>
<td class="paramtype">const char *&#160;</td>
<td class="paramname"><em>file_name</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char *&#160;</td>
<td class="paramname"><em>mode</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Open the specified file. This is a file factory method, it opens a proper file automatically based on prefix, e.g. "file://" for <a class="el" href="../../d7/dbd/classshaka_1_1LocalFile.html" title="Implement LocalFile which deals with local storage.">LocalFile</a>. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">file_name</td><td>contains the name of the file to be accessed. </td></tr>
<tr><td class="paramname">mode</td><td>contains file access mode. Implementation dependent. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A <a class="el" href="../../d3/d73/classshaka_1_1File.html" title="Define an abstract file interface.">File</a> pointer on success, false otherwise. </dd></dl>
<p class="definition">Definition at line <a class="el" href="../../d5/dfc/file_8cc_source.html#l00190">190</a> of file <a class="el" href="../../d5/dfc/file_8cc_source.html">file.cc</a>.</p>
</div>
</div>
2018-02-10 23:37:42 +00:00
<a id="a0a50526352bd6e946c4f33d3e8431b2d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0a50526352bd6e946c4f33d3e8431b2d">&#9670;&nbsp;</a></span>OpenWithNoBuffering()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="../../d3/d73/classshaka_1_1File.html">File</a> * shaka::File::OpenWithNoBuffering </td>
<td>(</td>
<td class="paramtype">const char *&#160;</td>
<td class="paramname"><em>file_name</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char *&#160;</td>
<td class="paramname"><em>mode</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Open the specified file in direct-access mode (no buffering). This is a file factory method, it opens a proper file automatically based on prefix, e.g. "file://" for <a class="el" href="../../d7/dbd/classshaka_1_1LocalFile.html" title="Implement LocalFile which deals with local storage.">LocalFile</a>. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">file_name</td><td>contains the name of the file to be accessed. </td></tr>
<tr><td class="paramname">mode</td><td>contains file access mode. Implementation dependent. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A <a class="el" href="../../d3/d73/classshaka_1_1File.html" title="Define an abstract file interface.">File</a> pointer on success, false otherwise. </dd></dl>
<p class="definition">Definition at line <a class="el" href="../../d5/dfc/file_8cc_source.html#l00201">201</a> of file <a class="el" href="../../d5/dfc/file_8cc_source.html">file.cc</a>.</p>
</div>
</div>
2018-02-10 23:37:42 +00:00
<a id="ae87642f9661588e47479721cd101bf7d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae87642f9661588e47479721cd101bf7d">&#9670;&nbsp;</a></span>ParseCallbackFileName()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">bool shaka::File::ParseCallbackFileName </td>
<td>(</td>
<td class="paramtype">const std::string &amp;&#160;</td>
<td class="paramname"><em>callback_file_name</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const <a class="el" href="../../d9/da8/structshaka_1_1BufferCallbackParams.html">BufferCallbackParams</a> **&#160;</td>
<td class="paramname"><em>callback_params</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">std::string *&#160;</td>
<td class="paramname"><em>name</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
2018-02-10 23:37:42 +00:00
<p>Parse and extract callback params. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">callback_file_name</td><td>is the name of the callback file which contains <em>callback_params</em> and <em>name</em>. </td></tr>
<tr><td class="paramname">callback_params</td><td>points to the parsed <a class="el" href="../../d9/da8/structshaka_1_1BufferCallbackParams.html" title="Buffer callback params.">BufferCallbackParams</a> pointer. </td></tr>
<tr><td class="paramname">name</td><td>points to the parsed name. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true on success, false otherwise. </dd></dl>
<p class="definition">Definition at line <a class="el" href="../../d5/dfc/file_8cc_source.html#l00412">412</a> of file <a class="el" href="../../d5/dfc/file_8cc_source.html">file.cc</a>.</p>
</div>
</div>
2018-02-10 23:37:42 +00:00
<a id="a6e1ecb2904b609554d332290f20fde0a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6e1ecb2904b609554d332290f20fde0a">&#9670;&nbsp;</a></span>Read()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">virtual int64_t shaka::File::Read </td>
<td>(</td>
<td class="paramtype">void *&#160;</td>
<td class="paramname"><em>buffer</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint64_t&#160;</td>
<td class="paramname"><em>length</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">pure virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
2018-02-10 23:37:42 +00:00
<p>Read data and return it in buffer. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[out]</td><td class="paramname">buffer</td><td>points to a block of memory with a size of at least <em>length</em> bytes. </td></tr>
<tr><td class="paramdir"></td><td class="paramname">length</td><td>indicates number of bytes to be read. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Number of bytes read, or a value &lt; 0 on error. Zero on end-of-file, or if 'length' is zero. </dd></dl>
2021-06-22 00:16:40 +00:00
<p>Implemented in <a class="el" href="../../d1/dc7/classshaka_1_1HttpFile.html#a5ae6eb4ad069afe42a6b3e940cefd49a">shaka::HttpFile</a>, <a class="el" href="../../d4/dcb/classshaka_1_1UdpFile.html#a74d352b51d543905abd4a12687e1bb98">shaka::UdpFile</a>, <a class="el" href="../../dd/d0c/classshaka_1_1ThreadedIoFile.html#af45702d95d4e46e93b1f4a897844212e">shaka::ThreadedIoFile</a>, <a class="el" href="../../d7/dbd/classshaka_1_1LocalFile.html#a27c3bf51fe18ebc10bf42ebcec20c9cb">shaka::LocalFile</a>, <a class="el" href="../../de/dad/classshaka_1_1MemoryFile.html#aeacb3b7f72e0c412bd0cba8a6f1ed62f">shaka::MemoryFile</a>, and <a class="el" href="../../dd/d40/classshaka_1_1CallbackFile.html#a867e0c5eaf81a41902e1370deb912617">shaka::CallbackFile</a>.</p>
</div>
</div>
2018-02-10 23:37:42 +00:00
<a id="ac9a19cb5fc45664ca440996bf1201c30"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac9a19cb5fc45664ca440996bf1201c30">&#9670;&nbsp;</a></span>ReadFileToString()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">bool shaka::File::ReadFileToString </td>
<td>(</td>
<td class="paramtype">const char *&#160;</td>
<td class="paramname"><em>file_name</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">std::string *&#160;</td>
<td class="paramname"><em>contents</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
2018-02-10 23:37:42 +00:00
<p>Read the contents of a file into string. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">file_name</td><td>is the file to be read. It should be a valid file. </td></tr>
<tr><td class="paramname">contents[out]</td><td>points to the output string. Should not be NULL. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true on success, false otherwise. </dd></dl>
<p class="definition">Definition at line <a class="el" href="../../d5/dfc/file_8cc_source.html#l00230">230</a> of file <a class="el" href="../../d5/dfc/file_8cc_source.html">file.cc</a>.</p>
</div>
</div>
2018-02-10 23:37:42 +00:00
<a id="a486bda715b58b1a1863fbfc8d48da62a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a486bda715b58b1a1863fbfc8d48da62a">&#9670;&nbsp;</a></span>Seek()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">virtual bool shaka::File::Seek </td>
<td>(</td>
<td class="paramtype">uint64_t&#160;</td>
<td class="paramname"><em>position</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">pure virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
2018-02-10 23:37:42 +00:00
<p>Seek to the specifield position in the file. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">position</td><td>is the position to seek to. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true on success, false otherwise. </dd></dl>
2021-06-22 00:16:40 +00:00
<p>Implemented in <a class="el" href="../../d1/dc7/classshaka_1_1HttpFile.html#a1664c0e4a8d13db5a1e1cadc5b637cd6">shaka::HttpFile</a>, <a class="el" href="../../d4/dcb/classshaka_1_1UdpFile.html#a33d10d2f1558a35aaba192f7746bb23f">shaka::UdpFile</a>, <a class="el" href="../../dd/d0c/classshaka_1_1ThreadedIoFile.html#a9b95550cf6342f970645c086a2ed58c2">shaka::ThreadedIoFile</a>, <a class="el" href="../../d7/dbd/classshaka_1_1LocalFile.html#a082cd6d64c8f04acff251cdafb66b203">shaka::LocalFile</a>, <a class="el" href="../../de/dad/classshaka_1_1MemoryFile.html#a0e3bffa9859fdcb7c28c20a15e2d3e98">shaka::MemoryFile</a>, and <a class="el" href="../../dd/d40/classshaka_1_1CallbackFile.html#a7c9039e25fcc468a7ec2cdfa8394ffc2">shaka::CallbackFile</a>.</p>
</div>
</div>
2018-02-10 23:37:42 +00:00
<a id="aeb98b64a05f141140e110170bef1bc55"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aeb98b64a05f141140e110170bef1bc55">&#9670;&nbsp;</a></span>Size()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">virtual int64_t shaka::File::Size </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">pure virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<dl class="section return"><dt>Returns</dt><dd>Size of the file in bytes. A return value less than zero indicates a problem getting the size. </dd></dl>
2021-06-22 00:16:40 +00:00
<p>Implemented in <a class="el" href="../../d1/dc7/classshaka_1_1HttpFile.html#aa88365f37eda6210577db4a70d68319e">shaka::HttpFile</a>, <a class="el" href="../../d4/dcb/classshaka_1_1UdpFile.html#a0a1c8d7af211bba4da62eb44504d745d">shaka::UdpFile</a>, <a class="el" href="../../dd/d0c/classshaka_1_1ThreadedIoFile.html#af23f2da404e1602c240bb59d2601f1b9">shaka::ThreadedIoFile</a>, <a class="el" href="../../d7/dbd/classshaka_1_1LocalFile.html#ad20649d0ee575b81830a5abf88e2bde1">shaka::LocalFile</a>, <a class="el" href="../../de/dad/classshaka_1_1MemoryFile.html#a151634866be009cf0eb10e783432d5cb">shaka::MemoryFile</a>, and <a class="el" href="../../dd/d40/classshaka_1_1CallbackFile.html#ab6bcbc6773b29fee1664507558e8759f">shaka::CallbackFile</a>.</p>
</div>
</div>
2018-02-10 23:37:42 +00:00
<a id="a07ae6476e88dab6c0cd9d8c0073b667d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a07ae6476e88dab6c0cd9d8c0073b667d">&#9670;&nbsp;</a></span>Tell()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">virtual bool shaka::File::Tell </td>
<td>(</td>
<td class="paramtype">uint64_t *&#160;</td>
<td class="paramname"><em>position</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">pure virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
2018-02-10 23:37:42 +00:00
<p>Get the current file position. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">position</td><td>is a pointer to contain the current file position upon successful return. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true on succcess, false otherwise. </dd></dl>
2021-06-22 00:16:40 +00:00
<p>Implemented in <a class="el" href="../../d1/dc7/classshaka_1_1HttpFile.html#a97d709df373c5fcbdbcb7e61b6e4f415">shaka::HttpFile</a>, <a class="el" href="../../d4/dcb/classshaka_1_1UdpFile.html#a4024a139655cf22f2cf2b4e56be8e1fc">shaka::UdpFile</a>, <a class="el" href="../../dd/d0c/classshaka_1_1ThreadedIoFile.html#a6ee5bcbe6bb8dd232679b2c50d968f4e">shaka::ThreadedIoFile</a>, <a class="el" href="../../d7/dbd/classshaka_1_1LocalFile.html#af111d93e10ae0128f082eef77eaa914b">shaka::LocalFile</a>, <a class="el" href="../../de/dad/classshaka_1_1MemoryFile.html#a4dfdba703861d211e7111612f5ac029c">shaka::MemoryFile</a>, and <a class="el" href="../../dd/d40/classshaka_1_1CallbackFile.html#adef67a4de398b8be95bb3ae4ce770d69">shaka::CallbackFile</a>.</p>
</div>
</div>
2018-02-10 23:37:42 +00:00
<a id="a8c498531ecbd205fceb0be3478361801"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8c498531ecbd205fceb0be3478361801">&#9670;&nbsp;</a></span>Write()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">virtual int64_t shaka::File::Write </td>
<td>(</td>
<td class="paramtype">const void *&#160;</td>
<td class="paramname"><em>buffer</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint64_t&#160;</td>
<td class="paramname"><em>length</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">pure virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
2018-02-10 23:37:42 +00:00
<p>Write block of data. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">buffer</td><td>points to a block of memory with at least <em>length</em> bytes. </td></tr>
<tr><td class="paramname">length</td><td>indicates number of bytes to write. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Number of bytes written, or a value &lt; 0 on error. </dd></dl>
2021-06-22 00:16:40 +00:00
<p>Implemented in <a class="el" href="../../d1/dc7/classshaka_1_1HttpFile.html#a412524f57722517b39d186fd10be445b">shaka::HttpFile</a>, <a class="el" href="../../d4/dcb/classshaka_1_1UdpFile.html#a36722f3c436c88e451093ee21c0db754">shaka::UdpFile</a>, <a class="el" href="../../dd/d0c/classshaka_1_1ThreadedIoFile.html#ab8acfe4af14c1120ae6d2baa44a10583">shaka::ThreadedIoFile</a>, <a class="el" href="../../d7/dbd/classshaka_1_1LocalFile.html#aee10b7f2898c5047eb8505f16c49311c">shaka::LocalFile</a>, <a class="el" href="../../de/dad/classshaka_1_1MemoryFile.html#aa3d9455b7bc9d1c44d58ab39bd8bd27c">shaka::MemoryFile</a>, and <a class="el" href="../../dd/d40/classshaka_1_1CallbackFile.html#aa758dfb05daff81afa1ddfaf0bb0a105">shaka::CallbackFile</a>.</p>
</div>
</div>
2018-02-10 23:37:42 +00:00
<a id="a4b5280fe058359b5991037f90dde2b77"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4b5280fe058359b5991037f90dde2b77">&#9670;&nbsp;</a></span>WriteFileAtomically()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">bool shaka::File::WriteFileAtomically </td>
<td>(</td>
<td class="paramtype">const char *&#160;</td>
<td class="paramname"><em>file_name</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const std::string &amp;&#160;</td>
<td class="paramname"><em>contents</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
2018-02-10 23:37:42 +00:00
<p>Save <code>contents</code> to <code>file_name</code> in an atomic manner. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">file_name</td><td>is the destination file name. </td></tr>
<tr><td class="paramname">contents</td><td>is the data to be saved. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true on success, false otherwise. </dd></dl>
<p class="definition">Definition at line <a class="el" href="../../d5/dfc/file_8cc_source.html#l00277">277</a> of file <a class="el" href="../../d5/dfc/file_8cc_source.html">file.cc</a>.</p>
</div>
</div>
2018-02-10 23:37:42 +00:00
<a id="a483ce187d628385d342748315d72f8ab"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a483ce187d628385d342748315d72f8ab">&#9670;&nbsp;</a></span>WriteStringToFile()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">bool shaka::File::WriteStringToFile </td>
<td>(</td>
<td class="paramtype">const char *&#160;</td>
<td class="paramname"><em>file_name</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const std::string &amp;&#160;</td>
<td class="paramname"><em>contents</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
2018-02-10 23:37:42 +00:00
<p>Writes the data to file. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">file_name</td><td>is the file to write to. </td></tr>
<tr><td class="paramname">contents</td><td>is the data to write. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true on success, false otherwise. </dd></dl>
<p class="definition">Definition at line <a class="el" href="../../d5/dfc/file_8cc_source.html#l00248">248</a> of file <a class="el" href="../../d5/dfc/file_8cc_source.html">file.cc</a>.</p>
</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>packager/file/<a class="el" href="../../d2/d4d/file_8h_source.html">file.h</a></li>
<li>packager/file/<a class="el" href="../../d5/dfc/file_8cc_source.html">file.cc</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
2021-06-22 00:16:40 +00:00
Generated on Tue Jun 22 2021 00:16:05 for Shaka Packager SDK by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="../../doxygen.png" alt="doxygen"/>
</a> 1.8.17
</small></address>
</body>
</html>