blob: 3d6c6afb1da0fe79179e8b4af12f7d329ab08711 [file] [log] [blame]
{{+bindTo:partials.standard_nacl_api}}
<h1>PPB_FileIO Struct Reference</h1>
<div id="doxygen-ref">
{{- dummy div to appease doxygen -}}
<div>
<!-- Generated by Doxygen 1.7.6.1 -->
</div>
<!--header-->
<div class="contents">
<!-- doxytag: class="PPB_FileIO" --><h2>
Data Fields</h2><table class="memberdecls">
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a>(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___file_i_o__1__1.html#aedb8773ba67e4c2a1ed3f3a249bb5e30">Create</a> )(<a class="el" href="group___typedefs.html#ga89b662403e6a687bb914b80114c0d19d">PP_Instance</a> instance)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___enums.html#ga4f272d99be14aacafe08dfd4ef830918">PP_Bool</a>(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___file_i_o__1__1.html#a09429d1ccad3a300cdc459f2ae4816e7">IsFileIO</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> resource)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int32_t(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___file_i_o__1__1.html#a860b24adbb67188de3fd66db44ff961e">Open</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> file_io, <a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> file_ref, int32_t open_flags, struct <a class="el" href="struct_p_p___completion_callback.html">PP_CompletionCallback</a> callback)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int32_t(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___file_i_o__1__1.html#acf7c4d3f2712e5aa436b2ac1588ada02">Query</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> file_io, struct <a class="el" href="struct_p_p___file_info.html">PP_FileInfo</a> *info, struct <a class="el" href="struct_p_p___completion_callback.html">PP_CompletionCallback</a> callback)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int32_t(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___file_i_o__1__1.html#a9f680131d9df0129d79492eb1b41edfc">Touch</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> file_io, <a class="el" href="group___typedefs.html#ga537b277d2116e42b6acfe9323d40e1a0">PP_Time</a> last_access_time, <a class="el" href="group___typedefs.html#ga537b277d2116e42b6acfe9323d40e1a0">PP_Time</a> last_modified_time, struct <a class="el" href="struct_p_p___completion_callback.html">PP_CompletionCallback</a> callback)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int32_t(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___file_i_o__1__1.html#ad9295a1eb59a2b31df2e522ec7794f0d">Read</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> file_io, int64_t offset, char *buffer, int32_t bytes_to_read, struct <a class="el" href="struct_p_p___completion_callback.html">PP_CompletionCallback</a> callback)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int32_t(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___file_i_o__1__1.html#a4cbaeff3318200d3913127553ad90aad">Write</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> file_io, int64_t offset, const char *buffer, int32_t bytes_to_write, struct <a class="el" href="struct_p_p___completion_callback.html">PP_CompletionCallback</a> callback)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int32_t(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___file_i_o__1__1.html#aea6686b51ee5a9ef40c2442a7faa652f">SetLength</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> file_io, int64_t length, struct <a class="el" href="struct_p_p___completion_callback.html">PP_CompletionCallback</a> callback)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int32_t(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___file_i_o__1__1.html#acf97d8e09d27253b6eb0b9ca9e7b20b1">Flush</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> file_io, struct <a class="el" href="struct_p_p___completion_callback.html">PP_CompletionCallback</a> callback)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___file_i_o__1__1.html#af321f0590ecd269b728106235e260e26">Close</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> file_io)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int32_t(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___file_i_o__1__1.html#a85f0de223c9011c79df5b063ecd4a89f">ReadToArray</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> file_io, int64_t offset, int32_t max_read_length, struct <a class="el" href="struct_p_p___array_output.html">PP_ArrayOutput</a> *output, struct <a class="el" href="struct_p_p___completion_callback.html">PP_CompletionCallback</a> callback)</td></tr>
</table>
<hr /><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>The <code>PPB_FileIO</code> struct is used to operate on a regular file (PP_FileType_Regular). </p>
</div><hr /><h2>Field Documentation</h2>
<a class="anchor" id="af321f0590ecd269b728106235e260e26"></a><!-- doxytag: member="PPB_FileIO::Close" ref="af321f0590ecd269b728106235e260e26" args=")(PP_Resource file_io)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void(* <a class="el" href="struct_p_p_b___file_i_o__1__1.html#af321f0590ecd269b728106235e260e26">PPB_FileIO::Close</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> file_io)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="struct_p_p_b___file_i_o__1__1.html#af321f0590ecd269b728106235e260e26" title="Close() cancels any IO that may be pending, and closes the FileIO object.">Close()</a> cancels any IO that may be pending, and closes the FileIO object. </p>
<p>Any pending callbacks will still run, reporting <code>PP_ERROR_ABORTED</code> if pending IO was interrupted. It is not valid to call <a class="el" href="struct_p_p_b___file_i_o__1__1.html#a860b24adbb67188de3fd66db44ff961e" title="Open() opens the specified regular file for I/O according to the given open flags, which is a bit-mask of the PP_FileOpenFlags values.">Open()</a> again after a call to this method. <b>Note:</b> If the FileIO object is destroyed, and it is still open, then it will be implicitly closed, so you are not required to call <a class="el" href="struct_p_p_b___file_i_o__1__1.html#af321f0590ecd269b728106235e260e26" title="Close() cancels any IO that may be pending, and closes the FileIO object.">Close()</a>.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">file_io</td><td>A <code>PP_Resource</code> corresponding to a file FileIO. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="aedb8773ba67e4c2a1ed3f3a249bb5e30"></a><!-- doxytag: member="PPB_FileIO::Create" ref="aedb8773ba67e4c2a1ed3f3a249bb5e30" args=")(PP_Instance instance)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a>(* <a class="el" href="struct_p_p_b___file_i_o__1__1.html#aedb8773ba67e4c2a1ed3f3a249bb5e30">PPB_FileIO::Create</a>)(<a class="el" href="group___typedefs.html#ga89b662403e6a687bb914b80114c0d19d">PP_Instance</a> instance)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="struct_p_p_b___file_i_o__1__1.html#aedb8773ba67e4c2a1ed3f3a249bb5e30" title="Create() creates a new FileIO object.">Create()</a> creates a new FileIO object. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">instance</td><td>A <code>PP_Instance</code> identifying the instance with the file.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>A <code>PP_Resource</code> corresponding to a FileIO if successful or 0 if the module is invalid. </dd></dl>
</div>
</div>
<a class="anchor" id="acf97d8e09d27253b6eb0b9ca9e7b20b1"></a><!-- doxytag: member="PPB_FileIO::Flush" ref="acf97d8e09d27253b6eb0b9ca9e7b20b1" args=")(PP_Resource file_io, struct PP_CompletionCallback callback)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t(* <a class="el" href="struct_p_p_b___file_i_o__1__1.html#acf97d8e09d27253b6eb0b9ca9e7b20b1">PPB_FileIO::Flush</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> file_io, struct <a class="el" href="struct_p_p___completion_callback.html">PP_CompletionCallback</a> callback)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="struct_p_p_b___file_i_o__1__1.html#acf97d8e09d27253b6eb0b9ca9e7b20b1" title="Flush() flushes changes to disk.">Flush()</a> flushes changes to disk. </p>
<p>This call can be very expensive! The FileIO object must have been opened with write access and there must be no other operations pending.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">file_io</td><td>A <code>PP_Resource</code> corresponding to a file FileIO. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">callback</td><td>A <code><a class="el" href="struct_p_p___completion_callback.html" title="PP_CompletionCallback is a common mechanism for supporting potentially asynchronous calls in browser ...">PP_CompletionCallback</a></code> to be called upon completion of <a class="el" href="struct_p_p_b___file_i_o__1__1.html#acf97d8e09d27253b6eb0b9ca9e7b20b1" title="Flush() flushes changes to disk.">Flush()</a>.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>An int32_t containing an error code from <code><a class="el" href="pp__errors_8h.html" title="This file defines an enumeration of all PPAPI error codes.">pp_errors.h</a></code>. PP_ERROR_FAILED will be returned if the file isn't opened, and PP_ERROR_INPROGRESS will be returned if there is another operation pending. </dd></dl>
</div>
</div>
<a class="anchor" id="a09429d1ccad3a300cdc459f2ae4816e7"></a><!-- doxytag: member="PPB_FileIO::IsFileIO" ref="a09429d1ccad3a300cdc459f2ae4816e7" args=")(PP_Resource resource)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group___enums.html#ga4f272d99be14aacafe08dfd4ef830918">PP_Bool</a>(* <a class="el" href="struct_p_p_b___file_i_o__1__1.html#a09429d1ccad3a300cdc459f2ae4816e7">PPB_FileIO::IsFileIO</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> resource)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="struct_p_p_b___file_i_o__1__1.html#a09429d1ccad3a300cdc459f2ae4816e7" title="IsFileIO() determines if the provided resource is a FileIO.">IsFileIO()</a> determines if the provided resource is a FileIO. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">resource</td><td>A <code>PP_Resource</code> corresponding to a FileIO.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd><code>PP_TRUE</code> if the resource is a <code>PPB_FileIO</code>, <code>PP_FALSE</code> if the resource is invalid or some type other than <code>PPB_FileIO</code>. </dd></dl>
</div>
</div>
<a class="anchor" id="a860b24adbb67188de3fd66db44ff961e"></a><!-- doxytag: member="PPB_FileIO::Open" ref="a860b24adbb67188de3fd66db44ff961e" args=")(PP_Resource file_io, PP_Resource file_ref, int32_t open_flags, struct PP_CompletionCallback callback)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t(* <a class="el" href="struct_p_p_b___file_i_o__1__1.html#a860b24adbb67188de3fd66db44ff961e">PPB_FileIO::Open</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> file_io, <a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> file_ref, int32_t open_flags, struct <a class="el" href="struct_p_p___completion_callback.html">PP_CompletionCallback</a> callback)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="struct_p_p_b___file_i_o__1__1.html#a860b24adbb67188de3fd66db44ff961e" title="Open() opens the specified regular file for I/O according to the given open flags, which is a bit-mask of the PP_FileOpenFlags values.">Open()</a> opens the specified regular file for I/O according to the given open flags, which is a bit-mask of the <code>PP_FileOpenFlags</code> values. </p>
<p>Upon success, the corresponding file is classified as "in use" by this FileIO object until such time as the FileIO object is closed or destroyed.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">file_io</td><td>A <code>PP_Resource</code> corresponding to a FileIO. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">file_ref</td><td>A <code>PP_Resource</code> corresponding to a file reference. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">open_flags</td><td>A bit-mask of the <code>PP_FileOpenFlags</code> values. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">callback</td><td>A <code><a class="el" href="struct_p_p___completion_callback.html" title="PP_CompletionCallback is a common mechanism for supporting potentially asynchronous calls in browser ...">PP_CompletionCallback</a></code> to be called upon completion of <a class="el" href="struct_p_p_b___file_i_o__1__1.html#a860b24adbb67188de3fd66db44ff961e" title="Open() opens the specified regular file for I/O according to the given open flags, which is a bit-mask of the PP_FileOpenFlags values.">Open()</a>.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>An int32_t containing an error code from <code><a class="el" href="pp__errors_8h.html" title="This file defines an enumeration of all PPAPI error codes.">pp_errors.h</a></code>. </dd></dl>
</div>
</div>
<a class="anchor" id="acf7c4d3f2712e5aa436b2ac1588ada02"></a><!-- doxytag: member="PPB_FileIO::Query" ref="acf7c4d3f2712e5aa436b2ac1588ada02" args=")(PP_Resource file_io, struct PP_FileInfo *info, struct PP_CompletionCallback callback)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t(* <a class="el" href="struct_p_p_b___file_i_o__1__1.html#acf7c4d3f2712e5aa436b2ac1588ada02">PPB_FileIO::Query</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> file_io, struct <a class="el" href="struct_p_p___file_info.html">PP_FileInfo</a> *info, struct <a class="el" href="struct_p_p___completion_callback.html">PP_CompletionCallback</a> callback)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="struct_p_p_b___file_i_o__1__1.html#acf7c4d3f2712e5aa436b2ac1588ada02" title="Query() queries info about the file opened by this FileIO object.">Query()</a> queries info about the file opened by this FileIO object. </p>
<p>The FileIO object must be opened, and there must be no other operations pending.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">file_io</td><td>A <code>PP_Resource</code> corresponding to a FileIO. </td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">info</td><td>The <code><a class="el" href="struct_p_p___file_info.html" title="The PP_FileInfo struct represents all information about a file, such as size, type, and creation time.">PP_FileInfo</a></code> structure representing all information about the file. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">callback</td><td>A <code><a class="el" href="struct_p_p___completion_callback.html" title="PP_CompletionCallback is a common mechanism for supporting potentially asynchronous calls in browser ...">PP_CompletionCallback</a></code> to be called upon completion of <a class="el" href="struct_p_p_b___file_i_o__1__1.html#acf7c4d3f2712e5aa436b2ac1588ada02" title="Query() queries info about the file opened by this FileIO object.">Query()</a>. <code>info</code> must remain valid until after the callback runs. If you pass a blocking callback, <code>info</code> must remain valid until after <a class="el" href="struct_p_p_b___file_i_o__1__1.html#acf7c4d3f2712e5aa436b2ac1588ada02" title="Query() queries info about the file opened by this FileIO object.">Query()</a> returns.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>An int32_t containing an error code from <code><a class="el" href="pp__errors_8h.html" title="This file defines an enumeration of all PPAPI error codes.">pp_errors.h</a></code>. PP_ERROR_FAILED will be returned if the file isn't opened, and PP_ERROR_INPROGRESS will be returned if there is another operation pending. </dd></dl>
</div>
</div>
<a class="anchor" id="ad9295a1eb59a2b31df2e522ec7794f0d"></a><!-- doxytag: member="PPB_FileIO::Read" ref="ad9295a1eb59a2b31df2e522ec7794f0d" args=")(PP_Resource file_io, int64_t offset, char *buffer, int32_t bytes_to_read, struct PP_CompletionCallback callback)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t(* <a class="el" href="struct_p_p_b___file_i_o__1__1.html#ad9295a1eb59a2b31df2e522ec7794f0d">PPB_FileIO::Read</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> file_io, int64_t offset, char *buffer, int32_t bytes_to_read, struct <a class="el" href="struct_p_p___completion_callback.html">PP_CompletionCallback</a> callback)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="struct_p_p_b___file_i_o__1__1.html#ad9295a1eb59a2b31df2e522ec7794f0d" title="Read() reads from an offset in the file.">Read()</a> reads from an offset in the file. </p>
<p>The size of the buffer must be large enough to hold the specified number of bytes to read. This function might perform a partial read, meaning all the requested bytes might not be returned, even if the end of the file has not been reached. The FileIO object must have been opened with read access.</p>
<p><a class="el" href="struct_p_p_b___file_i_o__1__1.html#a85f0de223c9011c79df5b063ecd4a89f" title="ReadToArray() reads from an offset in the file.">ReadToArray()</a> is preferred to <a class="el" href="struct_p_p_b___file_i_o__1__1.html#ad9295a1eb59a2b31df2e522ec7794f0d" title="Read() reads from an offset in the file.">Read()</a> when doing asynchronous operations.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">file_io</td><td>A <code>PP_Resource</code> corresponding to a file FileIO. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">offset</td><td>The offset into the file. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">buffer</td><td>The buffer to hold the specified number of bytes read. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">bytes_to_read</td><td>The number of bytes to read from <code>offset</code>. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">callback</td><td>A <code><a class="el" href="struct_p_p___completion_callback.html" title="PP_CompletionCallback is a common mechanism for supporting potentially asynchronous calls in browser ...">PP_CompletionCallback</a></code> to be called upon completion of <a class="el" href="struct_p_p_b___file_i_o__1__1.html#ad9295a1eb59a2b31df2e522ec7794f0d" title="Read() reads from an offset in the file.">Read()</a>. <code>buffer</code> must remain valid until after the callback runs. If you pass a blocking callback, <code>buffer</code> must remain valid until after <a class="el" href="struct_p_p_b___file_i_o__1__1.html#ad9295a1eb59a2b31df2e522ec7794f0d" title="Read() reads from an offset in the file.">Read()</a> returns.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>The number of bytes read or an error code from <code><a class="el" href="pp__errors_8h.html" title="This file defines an enumeration of all PPAPI error codes.">pp_errors.h</a></code>. If the return value is 0, then end-of-file was reached. It is valid to call <a class="el" href="struct_p_p_b___file_i_o__1__1.html#ad9295a1eb59a2b31df2e522ec7794f0d" title="Read() reads from an offset in the file.">Read()</a> multiple times with a completion callback to queue up parallel reads from the file, but pending reads cannot be interleaved with other operations. </dd></dl>
</div>
</div>
<a class="anchor" id="a85f0de223c9011c79df5b063ecd4a89f"></a><!-- doxytag: member="PPB_FileIO::ReadToArray" ref="a85f0de223c9011c79df5b063ecd4a89f" args=")(PP_Resource file_io, int64_t offset, int32_t max_read_length, struct PP_ArrayOutput *output, struct PP_CompletionCallback callback)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t(* <a class="el" href="struct_p_p_b___file_i_o__1__1.html#a85f0de223c9011c79df5b063ecd4a89f">PPB_FileIO::ReadToArray</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> file_io, int64_t offset, int32_t max_read_length, struct <a class="el" href="struct_p_p___array_output.html">PP_ArrayOutput</a> *output, struct <a class="el" href="struct_p_p___completion_callback.html">PP_CompletionCallback</a> callback)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="struct_p_p_b___file_i_o__1__1.html#a85f0de223c9011c79df5b063ecd4a89f" title="ReadToArray() reads from an offset in the file.">ReadToArray()</a> reads from an offset in the file. </p>
<p>A <a class="el" href="struct_p_p___array_output.html" title="A structure that defines a way for the browser to return arrays of data to the plugin.">PP_ArrayOutput</a> must be provided so that output will be stored in its allocated buffer. This function might perform a partial read. The FileIO object must have been opened with read access.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">file_io</td><td>A <code>PP_Resource</code> corresponding to a file FileIO. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">offset</td><td>The offset into the file. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">max_read_length</td><td>The maximum number of bytes to read from <code>offset</code>. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">output</td><td>A <code><a class="el" href="struct_p_p___array_output.html" title="A structure that defines a way for the browser to return arrays of data to the plugin.">PP_ArrayOutput</a></code> to hold the output data. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">callback</td><td>A <code><a class="el" href="struct_p_p___completion_callback.html" title="PP_CompletionCallback is a common mechanism for supporting potentially asynchronous calls in browser ...">PP_CompletionCallback</a></code> to be called upon completion of <a class="el" href="struct_p_p_b___file_i_o__1__1.html#a85f0de223c9011c79df5b063ecd4a89f" title="ReadToArray() reads from an offset in the file.">ReadToArray()</a>.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>The number of bytes read or an error code from <code><a class="el" href="pp__errors_8h.html" title="This file defines an enumeration of all PPAPI error codes.">pp_errors.h</a></code>. If the return value is 0, then end-of-file was reached. It is valid to call <a class="el" href="struct_p_p_b___file_i_o__1__1.html#a85f0de223c9011c79df5b063ecd4a89f" title="ReadToArray() reads from an offset in the file.">ReadToArray()</a> multiple times with a completion callback to queue up parallel reads from the file, but pending reads cannot be interleaved with other operations. </dd></dl>
</div>
</div>
<a class="anchor" id="aea6686b51ee5a9ef40c2442a7faa652f"></a><!-- doxytag: member="PPB_FileIO::SetLength" ref="aea6686b51ee5a9ef40c2442a7faa652f" args=")(PP_Resource file_io, int64_t length, struct PP_CompletionCallback callback)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t(* <a class="el" href="struct_p_p_b___file_i_o__1__1.html#aea6686b51ee5a9ef40c2442a7faa652f">PPB_FileIO::SetLength</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> file_io, int64_t length, struct <a class="el" href="struct_p_p___completion_callback.html">PP_CompletionCallback</a> callback)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="struct_p_p_b___file_i_o__1__1.html#aea6686b51ee5a9ef40c2442a7faa652f" title="SetLength() sets the length of the file.">SetLength()</a> sets the length of the file. </p>
<p>If the file size is extended, then the extended area of the file is zero-filled. The FileIO object must have been opened with write access and there must be no other operations pending.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">file_io</td><td>A <code>PP_Resource</code> corresponding to a file FileIO. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">length</td><td>The length of the file to be set. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">callback</td><td>A <code><a class="el" href="struct_p_p___completion_callback.html" title="PP_CompletionCallback is a common mechanism for supporting potentially asynchronous calls in browser ...">PP_CompletionCallback</a></code> to be called upon completion of <a class="el" href="struct_p_p_b___file_i_o__1__1.html#aea6686b51ee5a9ef40c2442a7faa652f" title="SetLength() sets the length of the file.">SetLength()</a>.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>An int32_t containing an error code from <code><a class="el" href="pp__errors_8h.html" title="This file defines an enumeration of all PPAPI error codes.">pp_errors.h</a></code>. PP_ERROR_FAILED will be returned if the file isn't opened, and PP_ERROR_INPROGRESS will be returned if there is another operation pending. </dd></dl>
</div>
</div>
<a class="anchor" id="a9f680131d9df0129d79492eb1b41edfc"></a><!-- doxytag: member="PPB_FileIO::Touch" ref="a9f680131d9df0129d79492eb1b41edfc" args=")(PP_Resource file_io, PP_Time last_access_time, PP_Time last_modified_time, struct PP_CompletionCallback callback)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t(* <a class="el" href="struct_p_p_b___file_i_o__1__1.html#a9f680131d9df0129d79492eb1b41edfc">PPB_FileIO::Touch</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> file_io, <a class="el" href="group___typedefs.html#ga537b277d2116e42b6acfe9323d40e1a0">PP_Time</a> last_access_time, <a class="el" href="group___typedefs.html#ga537b277d2116e42b6acfe9323d40e1a0">PP_Time</a> last_modified_time, struct <a class="el" href="struct_p_p___completion_callback.html">PP_CompletionCallback</a> callback)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="struct_p_p_b___file_i_o__1__1.html#a9f680131d9df0129d79492eb1b41edfc" title="Touch() Updates time stamps for the file opened by this FileIO object.">Touch()</a> Updates time stamps for the file opened by this FileIO object. </p>
<p>This function will fail if the FileIO object has not been opened. The FileIO object must be opened, and there must be no other operations pending.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">file_io</td><td>A <code>PP_Resource</code> corresponding to a file FileIO. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">last_access_time</td><td>The last time the FileIO was accessed. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">last_modified_time</td><td>The last time the FileIO was modified. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">callback</td><td>A <code><a class="el" href="struct_p_p___completion_callback.html" title="PP_CompletionCallback is a common mechanism for supporting potentially asynchronous calls in browser ...">PP_CompletionCallback</a></code> to be called upon completion of <a class="el" href="struct_p_p_b___file_i_o__1__1.html#a9f680131d9df0129d79492eb1b41edfc" title="Touch() Updates time stamps for the file opened by this FileIO object.">Touch()</a>.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>An int32_t containing an error code from <code><a class="el" href="pp__errors_8h.html" title="This file defines an enumeration of all PPAPI error codes.">pp_errors.h</a></code>. PP_ERROR_FAILED will be returned if the file isn't opened, and PP_ERROR_INPROGRESS will be returned if there is another operation pending. </dd></dl>
</div>
</div>
<a class="anchor" id="a4cbaeff3318200d3913127553ad90aad"></a><!-- doxytag: member="PPB_FileIO::Write" ref="a4cbaeff3318200d3913127553ad90aad" args=")(PP_Resource file_io, int64_t offset, const char *buffer, int32_t bytes_to_write, struct PP_CompletionCallback callback)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t(* <a class="el" href="struct_p_p_b___file_i_o__1__1.html#a4cbaeff3318200d3913127553ad90aad">PPB_FileIO::Write</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> file_io, int64_t offset, const char *buffer, int32_t bytes_to_write, struct <a class="el" href="struct_p_p___completion_callback.html">PP_CompletionCallback</a> callback)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="struct_p_p_b___file_i_o__1__1.html#a4cbaeff3318200d3913127553ad90aad" title="Write() writes to an offset in the file.">Write()</a> writes to an offset in the file. </p>
<p>This function might perform a partial write. The FileIO object must have been opened with write access.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">file_io</td><td>A <code>PP_Resource</code> corresponding to a file FileIO. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">offset</td><td>The offset into the file. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">buffer</td><td>The buffer to hold the specified number of bytes read. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">bytes_to_write</td><td>The number of bytes to write to <code>offset</code>. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">callback</td><td>A <code><a class="el" href="struct_p_p___completion_callback.html" title="PP_CompletionCallback is a common mechanism for supporting potentially asynchronous calls in browser ...">PP_CompletionCallback</a></code> to be called upon completion of <a class="el" href="struct_p_p_b___file_i_o__1__1.html#a4cbaeff3318200d3913127553ad90aad" title="Write() writes to an offset in the file.">Write()</a>.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>The number of bytes written or an error code from <code><a class="el" href="pp__errors_8h.html" title="This file defines an enumeration of all PPAPI error codes.">pp_errors.h</a></code>. If the return value is 0, then end-of-file was reached. It is valid to call <a class="el" href="struct_p_p_b___file_i_o__1__1.html#a4cbaeff3318200d3913127553ad90aad" title="Write() writes to an offset in the file.">Write()</a> multiple times with a completion callback to queue up parallel writes to the file, but pending writes cannot be interleaved with other operations. </dd></dl>
</div>
</div>
<hr />The documentation for this struct was generated from the following file:<ul>
<li><a class="el" href="ppb__file__io_8h.html">ppb_file_io.h</a></li>
</ul>
</div><!-- contents -->
</div>
{{/partials.standard_nacl_api}}