Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Static Public Member Functions | Protected Attributes
CPluginInputStream Class Reference
Inheritance diagram for CPluginInputStream:
Inheritance graph
[legend]
Collaboration diagram for CPluginInputStream:
Collaboration graph
[legend]

List of all members.

Public Member Functions

NS_DECL_ISUPPORTS
NS_DECL_NSIINPUTSTREAM
NS_IMETHOD 
GetLastModified (PRUint32 *result)
NS_IMETHOD RequestRead (nsByteRange *rangeList)
 CPluginInputStream (nsIPluginStreamListener *listener)
virtual ~CPluginInputStream (void)
void SetStreamInfo (NPP npp, NPStream *stream)
nsIPluginStreamListenerGetListener (void)
nsPluginStreamType GetStreamType (void)
nsresult SetReadBuffer (PRUint32 len, const char *buffer)
char * dup (PRUint32 len, const char *buffer)
nsIPluginStreamInfoCreatePluginStreamInfo (const char *url, nsMIMEType type, PRBool seekable)
nsIPluginStreamInfoGetPluginStreamInfo ()
NS_DECL_ISUPPORTS NS_IMETHOD Close (void)
 Close the stream.
NS_IMETHOD Available (PRUint32 *aLength)
 Return the number of bytes in the stream.
NS_IMETHOD Read (char *aBuf, PRUint32 aCount, PRUint32 *aReadCount)
 Read data from the stream.
NS_IMETHOD ReadSegments (nsWriteSegmentFun writer, void *closure, PRUint32 count, PRUint32 *_retval)
NS_IMETHOD IsNonBlocking (PRBool *aNonBlocking)
NS_IMETHOD GetLastModified (PRUint32 *result)
NS_IMETHOD RequestRead (nsByteRange *rangeList)
 CPluginInputStream (nsIPluginStreamListener *listener)
virtual ~CPluginInputStream (void)
void SetStreamInfo (NPP npp, NPStream *stream)
nsIPluginStreamListenerGetListener (void)
nsPluginStreamType GetStreamType (void)
nsresult SetReadBuffer (PRUint32 len, const char *buffer)
nsIPluginStreamInfoCreatePluginStreamInfo (const char *url, nsMIMEType type, PRBool seekable)
nsIPluginStreamInfoGetPluginStreamInfo ()
void getLastModified (out unsigned long aResult)
 Corresponds to NPStream's lastmodified field.)
void requestRead (out nsByteRange aRangeList)
void close ()
 Close the stream.
unsigned long available ()
unsigned long read (in charPtr aBuf, in unsigned long aCount)
 Read data from the stream.
unsigned long readSegments (in nsWriteSegmentFun aWriter, in voidPtr aClosure, in unsigned long aCount)
 Low-level read method that has access to the stream's underlying buffer.
boolean isNonBlocking ()

Static Public Member Functions

static char * dup (PRUint32 len, const char *buffer)

Protected Attributes

const char * mURL
nsIPluginStreamListenermListener
nsPluginStreamType mStreamType
NPP mNPP
NPStreammStream
char * mBuffer
PRUint32 mBufferLength
PRUint32 mAmountRead
nsIPluginStreamInfomStreamInfo

Detailed Description

Definition at line 428 of file badapter.cpp.


Constructor & Destructor Documentation

Definition at line 1716 of file badapter.cpp.

Here is the call graph for this function:

Definition at line 1728 of file badapter.cpp.


Member Function Documentation

unsigned long nsIInputStream::available ( ) [inherited]
Returns:
number of bytes currently available in the stream

Return the number of bytes in the stream.

Parameters:
aLengthout parameter to hold the length of the stream. if an error occurs, the length will be undefined
Returns:
error status

Definition at line 2519 of file BackwardAdapter.cpp.

{
    *aLength = mStream->end;
    return NS_OK;
}
void nsIInputStream::close ( ) [inherited]

Close the stream.

Close the stream.

Definition at line 1740 of file badapter.cpp.

Here is the call graph for this function:

nsIPluginStreamInfo* CPluginInputStream::CreatePluginStreamInfo ( const char *  url,
nsMIMEType  type,
PRBool  seekable 
) [inline]

Definition at line 478 of file badapter.cpp.

                                                                                                      {
              if (mStreamInfo == NULL) {
                     mStreamInfo = new CPluginStreamInfo(url, this, type, seekable);
                     mStreamInfo->AddRef();
              }
              return mStreamInfo;
       }

Here is the caller graph for this function:

nsIPluginStreamInfo* CPluginInputStream::CreatePluginStreamInfo ( const char *  url,
nsMIMEType  type,
PRBool  seekable 
) [inline]

Definition at line 898 of file BackwardAdapter.cpp.

                                                                                                      {
              if (mStreamInfo == NULL) {
                     mStreamInfo = new CPluginStreamInfo(url, this, type, seekable);
                     NS_IF_ADDREF(mStreamInfo);
              }
              return mStreamInfo;
       }
char* CPluginInputStream::dup ( PRUint32  len,
const char *  buffer 
) [inline]

Definition at line 467 of file badapter.cpp.

                                                {
       char* result = new char[len];
       if (result != NULL) {
              const char *src = buffer;
              char *dest = result; 
              while (len-- > 0)
                     *dest++ = *src++;
       }
       return result;
    }

Here is the caller graph for this function:

static char* CPluginInputStream::dup ( PRUint32  len,
const char *  buffer 
) [inline, static]

Definition at line 891 of file BackwardAdapter.cpp.

                                                       {
       char* result = new char[len];
       if (result != NULL)
           memcpy(result, buffer, len);
       return result;
    }

Here is the call graph for this function:

void nsIPluginInputStream::getLastModified ( out unsigned long  aResult) [inherited]

Corresponds to NPStream's lastmodified field.)

Definition at line 1767 of file badapter.cpp.

{
    *result = mStream->lastmodified;
    return NS_OK;
}

Definition at line 456 of file badapter.cpp.

{ return mListener; }

Here is the caller graph for this function:

Definition at line 879 of file BackwardAdapter.cpp.

{ return mListener; }

Definition at line 486 of file badapter.cpp.

                                                  {
              return mStreamInfo;
       }

Here is the caller graph for this function:

Definition at line 906 of file BackwardAdapter.cpp.

                                                  {
              return mStreamInfo;
       }

Definition at line 457 of file badapter.cpp.

{ return mStreamType; }

Here is the caller graph for this function:

Definition at line 880 of file BackwardAdapter.cpp.

{ return mStreamType; }
Returns:
true if stream is non-blocking
NS_IMETHOD CPluginInputStream::IsNonBlocking ( PRBool aNonBlocking) [inline]

Definition at line 853 of file BackwardAdapter.cpp.

                                                   {
        NS_NOTREACHED("IsNonBlocking");
        return NS_ERROR_NOT_IMPLEMENTED;
    }
unsigned long nsIInputStream::read ( in charPtr  aBuf,
in unsigned long  aCount 
) [inherited]

Read data from the stream.

Parameters:
aBufthe buffer into which the data is to be read
aCountthe maximum number of bytes to be read
Returns:
number of bytes read (may be less than aCount).
0 if reached end of file
Exceptions:
NS_BASE_STREAM_WOULD_BLOCKif reading from the input stream would block the calling thread (non-blocking mode only)
<other-error>on failure
NS_METHOD CPluginInputStream::Read ( char *  aBuf,
PRUint32  aCount,
PRUint32 aReadCount 
)

Read data from the stream.

Parameters:
aErrorCodethe error code if an error occurs
aBufthe buffer into which the data is read
aCountthe maximum number of bytes to read
aReadCountout parameter to hold the number of bytes read, eof if 0. if an error occurs, the read count will be undefined
Returns:
error status

Definition at line 1756 of file badapter.cpp.

{
    PRUint32 cnt = PR_MIN(aCount, mBufferLength);
    memcpy(aBuf, mBuffer + mAmountRead, cnt);
    *aReadCount = cnt;
    mAmountRead += cnt;
    mBufferLength -= cnt;
    return NS_OK;
}

Here is the call graph for this function:

unsigned long nsIInputStream::readSegments ( in nsWriteSegmentFun  aWriter,
in voidPtr  aClosure,
in unsigned long  aCount 
) [inherited]

Low-level read method that has access to the stream's underlying buffer.

The writer function may be called multiple times for segmented buffers. ReadSegments is expected to keep calling the writer until either there is nothing left to read or the writer returns an error. ReadSegments should not call the writer with zero bytes to consume.

Parameters:
aWriterthe "consumer" of the data to be read
aClosureopaque parameter passed to writer
aCountthe maximum number of bytes to be read
Returns:
number of bytes read (may be less than aCount)
0 if reached end of file (or if aWriter refused to consume data)
Exceptions:
NS_BASE_STREAM_WOULD_BLOCKif reading from the input stream would block the calling thread (non-blocking mode only)
<other-error>on failure

NOTE: this function may be unimplemented if a stream has no underlying buffer (e.g., socket input stream).

NS_IMETHOD CPluginInputStream::ReadSegments ( nsWriteSegmentFun  writer,
void closure,
PRUint32  count,
PRUint32 _retval 
) [inline]

Definition at line 848 of file BackwardAdapter.cpp.

                                                                                                         {
        NS_NOTREACHED("ReadSegments");
        return NS_ERROR_NOT_IMPLEMENTED;
    }

Definition at line 1774 of file badapter.cpp.

Here is the call graph for this function:

nsresult CPluginInputStream::SetReadBuffer ( PRUint32  len,
const char *  buffer 
) [inline]

Definition at line 459 of file badapter.cpp.

                                                             {
        // XXX this has to be way more sophisticated
        mBuffer = dup(len, buffer);
        mBufferLength = len;
        mAmountRead = 0;
        return NS_OK;
    }

Here is the caller graph for this function:

nsresult CPluginInputStream::SetReadBuffer ( PRUint32  len,
const char *  buffer 
) [inline]

Definition at line 882 of file BackwardAdapter.cpp.

                                                             {
        // XXX this has to be way more sophisticated
        if (mBuffer != NULL) delete[] mBuffer;
        mBuffer = dup(len, buffer);
        mBufferLength = len;
        mAmountRead = 0;
        return NS_OK;
    }

Here is the call graph for this function:

void CPluginInputStream::SetStreamInfo ( NPP  npp,
NPStream stream 
) [inline]

Definition at line 451 of file badapter.cpp.

                                                  {
        mNPP = npp;
        mStream = stream;
    }

Here is the caller graph for this function:

void CPluginInputStream::SetStreamInfo ( NPP  npp,
NPStream stream 
) [inline]

Definition at line 874 of file BackwardAdapter.cpp.

                                                  {
        mNPP = npp;
        mStream = stream;
    }

Member Data Documentation

Definition at line 498 of file badapter.cpp.

char * CPluginInputStream::mBuffer [protected]

Definition at line 496 of file badapter.cpp.

Definition at line 497 of file badapter.cpp.

Definition at line 492 of file badapter.cpp.

Definition at line 494 of file badapter.cpp.

Definition at line 495 of file badapter.cpp.

Definition at line 499 of file badapter.cpp.

Definition at line 493 of file badapter.cpp.

const char * CPluginInputStream::mURL [protected]

Definition at line 491 of file badapter.cpp.


The documentation for this class was generated from the following files: