mozilla
검색 결과

    NPP_WriteReady

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

    « Gecko Plugin API Reference « Plug-in Side Plug-in 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

    문서 태그 및 공헌자

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