검색 결과


    아직 자원 봉사자들이 한국어로 현재 문서를 번역하지 않았습니다. 가입해서 이 문서가 번역되는 일에 함께 해 주세요!

    « 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:

    Pointer to the current plug-in instance.
    Pointer to the current stream.
    Offset in bytes of buf from the beginning of the data in the stream. Can be used to check stream progress or by range requests from NPN_RequestRead.
    Length in bytes of buf; number of bytes accepted.
    Buffer of data, delivered by the stream, that contains len bytes of data offset bytes from the start of the stream. The buffer is allocated by the browser and is deleted after returning from the function, so the plug-in should make a copy of the data it needs to keep.


    • 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.
    • If unsuccessful, the function signals an error by returning a negative value. The browser will destroy the stream by calling NPP_DestroyStream.


    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:

    • If the plug-in requested a normal-mode stream, the data in the stream is delivered to the plug-in instance in a series of calls to NPP_WriteReady and NPP_Write.
    • If the plug-in requested a seekable stream, the NPN_RequestRead function requests reads of a specified byte range that results in a series of calls to NPP_WriteReady and 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.

    See Also

    NPP_DestroyStream, NPP_NewStream, NPP_WriteReady, NPStream, NPP

    문서 태그 및 공헌자

    Contributors to this page: Pmash, Nocnick, BenjaminSmedberg
    최종 변경: BenjaminSmedberg,