NPN_Write

  • Revision slug: NPN_Write
  • Revision title: NPN_Write
  • Revision id: 90519
  • Created:
  • Creator: Rickwookie
  • Is current revision? No
  • Comment /* Syntax */

Revision Content

{{ Np-browser-api() }}

Summary

Pushes data into a stream produced by the plug-in and consumed by the browser

Syntax

#include <npapi.h>
 
int32 NPN_Write(NPP       instance, 
          NPStream* stream,
          int32     len,
          void*      buf);

Parameters

The function has the following parameters:

instance
Pointer to the current plug-in instance.
stream
Pointer to the current stream.
len
Length in bytes of buf.
buf
Buffer of data delivered for the stream.

Returns

  • If successful, the function returns a positive integer representing the number of bytes written (consumed by the browser). This number depends on the size of the browser's memory buffers, the number of active streams, and other factors.
  • If unsuccessful, the plug-in returns a negative integer. This indicates that the browser encountered an error while processing the data, so the plug-in should terminate the stream by calling NPN_DestroyStream.

Description

NPN_Write delivers a buffer from the stream to the instance. A plug-in can call this function multiple times after creating a stream with NPN_NewStream. The browser makes a copy of the buffer if necessary, so the plug-in can free the buffer as the method returns, if desired. See "Example of Sending a Stream" for an example that includes NPN_Write.

See Also

NPP_NewStream, NPP_DestroyStream, NPP_Write, NPStream, NPP

Revision Source

<p>
{{ Np-browser-api() }}
</p>
<h3 name="Summary">Summary</h3>
<p>Pushes data into a stream produced by the plug-in and consumed by the browser
</p>
<h3 name="Syntax">Syntax</h3>
<pre>#include &lt;npapi.h&gt;
 
int32 NPN_Write(NPP       instance, 
          NPStream* stream,
          int32     len,
          void*      buf);
</pre>
<h3 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>
<dl><dt>len
</dt><dd>Length in bytes of buf.
</dd></dl>
<dl><dt>buf
</dt><dd>Buffer of data delivered for the stream.
</dd></dl>
<h3 name="Returns">Returns</h3>
<ul><li> If successful, the function returns a positive integer representing the number of bytes written (consumed by the browser). This number depends on the size of the browser's memory buffers, the number of active streams, and other factors.
</li><li> If unsuccessful, the plug-in returns a negative integer. This indicates that the browser encountered an error while processing the data, so the plug-in should terminate the stream by calling <a href="en/NPN_DestroyStream">NPN_DestroyStream</a>. </li></ul>
<h3 name="Description">Description</h3>
<p><code>NPN_Write</code> delivers a buffer from the stream to the instance. A plug-in can call this function multiple times after creating a stream with <a href="en/NPN_NewStream">NPN_NewStream</a>. The browser makes a copy of the buffer if necessary, so the plug-in can free the buffer as the method returns, if desired. See "Example of Sending a Stream" for an example that includes <code>NPN_Write</code>.
</p>
<h3 name="See_Also">See Also</h3>
<p><a href="en/NPP_NewStream">NPP_NewStream</a>, <a href="en/NPP_DestroyStream">NPP_DestroyStream</a>, <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