This article is in need of a technical review.
#include <npapi.h> NPError NPN_RequestRead(NPStream* stream, NPByteRange* rangeList);
The function has the following parameters:
Stream of type
NP_SEEKfrom which to read bytes.
Range of bytes in the form of a linked list of
NPByteRangeobjects, each of which specifies a request for a range of bytes.
- If successful, the function returns
- If unsuccessful, the function returns an error code. For possible values, see Error Codes.
For a seekable stream, the browser sends data only in response to requests by the plug-in. The plug-in calls
NPN_RequestRead() to request data from a seekable stream.
The plug-in can use this function to make one or more requests for ranges of bytes. These requests result in subsequent calls to
NPP_Write(). For multiple requests, the function creates a linked list of
NPByteRange structures, each of which represents a separate request.
If the plug-in requests multiple ranges (either through a list of
NPByteRange objects in a single call to
NPN_RequestRead(), or multiple calls to
NPN_RequestRead()), the browser can write individual ranges in any order, and with any number of
The plug-in must allocate
NPByteRange objects, which the browser copies if necessary. The plug-in can free these as soon as the call returns.
- The plug-in can call
NPN_RequestRead()on streams that were not initially in
NP_SEEKmode as long as the stream is inherently seekable;
NPN_RequestRead()automatically changes the mode to
- If the stream is not inherently seekable, the stream must have been put in
NP_SEEKmode initially (since the browser must cache all the stream data on disk in order to access it randomly).
NPN_RequestRead()is called on a stream that is not inherently seekable and not initially in mode
NP_SEEK, it returns the error code
Typically, the only streams that are inherently seekable are those from in-memory or on-disk data, or from HTTP servers that support byte-range requests.