mozilla

Revision 184162 of NPP_WriteReady

  • Revision slug: NPP_WriteReady
  • Revision title: NPP_WriteReady
  • Revision id: 184162
  • Created:
  • Creator: Nocnick
  • Is current revision? Yes
  • Comment /* Description */
Tags: 

Revision Content

{{ Np-plugin-api() }}

Summary

Determines maximum number of bytes that the plug-in can consume.

Syntax

#include <npapi.h>
 
int32 NPP_WriteReady(NPP instance, NPStream* stream);

Parameters

The function has the following parameters:

instance
Pointer to the current plug-in instance.
stream
Pointer to the current stream.

Returns

Returns the maximum number of bytes that an instance is prepared to accept from the stream.

Description

The browser calls NPP_WriteReady before each call to NPP_Write to determine whether a plug-in can receive data and how many bytes it can receive. This function allows the browser to send only as much data to the instance as it can handle at one time, making resource use more efficient for both the browser and plug-in.

The NPP_Write function may pass a larger buffer, but the plug-in is required to consume only the amount of data returned by NPP_WriteReady.

The browser can write a smaller amount of data if desired or necessary; for example, if only 8K of data is available in a network buffer. If the plug-in is allocating memory for the entire stream at once (an AS_FILE stream), it can return a very large number. Because it is not processing streaming data, the browser can pass as much data to the instance as necessary in a single NPP_Write.

If the browser receives a value of zero, the data flow temporarily stops. The browser checks to see if the plug-in can receive data again by resending the data at regular intervals.

See Also

NPP_Write, NPStream, NPP

Revision Source

<p>
{{ Np-plugin-api() }}
</p>
<h3 id="Summary" name="Summary">Summary</h3>
<p>Determines maximum number of bytes that the plug-in can consume.
</p>
<h3 id="Syntax" name="Syntax">Syntax</h3>
<pre>#include &lt;npapi.h&gt;
 
int32 NPP_WriteReady(NPP instance, NPStream* stream);
</pre> <h3 id="Parameters" name="Parameters">Parameters</h3>
<p>The function has the following parameters:
</p>
<dl><dt>instance
</dt><dd>Pointer to the current plug-in instance.
</dd></dl>
<dl><dt>stream
</dt><dd>Pointer to the current stream.
</dd></dl>
<h3 id="Returns" name="Returns">Returns</h3>
<p>Returns the maximum number of bytes that an instance is prepared to accept from the stream.
</p>
<h3 id="Description" name="Description">Description</h3>
<p>The browser calls <code>NPP_WriteReady</code> before each call to <a href="en/NPP_Write">NPP_Write</a> to determine whether a plug-in can receive data and how many bytes it can receive. This function allows the browser to send only as much data to the instance as it can handle at one time, making resource use more efficient for both the browser and plug-in.
</p><p>The <a href="en/NPP_Write">NPP_Write</a> function may pass a larger buffer, but the plug-in is required to consume only the amount of data returned by <code>NPP_WriteReady</code>.
</p><p>The browser can write a smaller amount of data if desired or necessary; for example, if only 8K of data is available in a network buffer. If the plug-in is allocating memory for the entire stream at once (an <code>AS_FILE</code> stream), it can return a very large number. Because it is not processing streaming data, the browser can pass as much data to the instance as necessary in a single <a href="en/NPP_Write">NPP_Write</a>.
</p><p>If the browser receives a value of zero, the data flow temporarily stops. The browser checks to see if the plug-in can receive data again by resending the data at regular intervals.
</p>
<h3 id="See_Also" name="See_Also">See Also</h3>
<p><a href="en/NPP_Write">NPP_Write</a>, <a href="en/NPStream">NPStream</a>, <a href="en/NPP">NPP</a>
</p>
Revert to this revision