« Gecko Plugin API Reference « Plug-in Side Plug-in API
Delivers data to a plug-in instance. (Remark: Hence the name "NPP_Write" is misleading - just think of:"Data_Arrived")
#include <npapi.h>
int32 NPP_Write(NPP instance,
NPStream* stream,
int32 offset,
int32 len,
void* buf);
The function has the following parameters:
The browser calls the NPP_Write function to deliver the data specified in a previous NPP_WriteReady call to the plug-in. A plug-in must consume at least as many bytes as indicated in the NPP_WriteReady call.
After a stream is created by a call to NPP_NewStream, the browser calls NPP_Write either:
NPP_Write.
NPP_Write. The plug-in can use the offset parameter to track the bytes that are written. This gives you different information depending in the type of stream. In a normal-mode stream., the parameter value increases as the each buffer is written. The buf parameter is not persistent, so the plug-in must process data immediately or allocate memory and save a copy of it. In a seekable stream with byte range requests, you can use this parameter to track NPN_RequestRead requests.
The plug-in should return the number of bytes written (consumed by the instance). If the return value is smaller than the size of the buffer, the browser sends the remaining data to the plug-in through subsequent calls to NPP_WriteReady and NPP_Write. A negative return value causes an error on the stream, which causes the browser to destroy the stream with NPP_DestroyStream.
Page last modified 17:06, 27 Jul 2007 by Nocnick