Back to index

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

List of all members.

Public Member Functions

 CPluginManagerStream (NPP npp, NPStream *pstr)
virtual ~CPluginManagerStream (void)
NS_DECL_ISUPPORTS NS_IMETHOD Write (const char *aBuf, PRUint32 aCount, PRUint32 *aWriteCount)
 Write data into the stream.
NS_IMETHOD Flush ()
NS_IMETHOD GetURL (const char **result)
NS_IMETHOD GetEnd (PRUint32 *result)
NS_IMETHOD GetLastModified (PRUint32 *result)
NS_IMETHOD GetNotifyData (void **result)
NS_IMETHOD Close (void)
 CPluginManagerStream (NPP npp, NPStream *pstr)
virtual ~CPluginManagerStream (void)
NS_DECL_ISUPPORTS NS_IMETHOD Write (const char *aBuf, PRUint32 aCount, PRUint32 *aWriteCount)
 Write data into the stream.
NS_IMETHOD Write (nsIInputStream *fromStream, PRUint32 *aWriteCount)
 Writes data into the stream from an input stream.
NS_IMETHOD Flush (void)
 Flushes the stream.
NS_IMETHOD WriteFrom (nsIInputStream *inStr, PRUint32 count, PRUint32 *_retval)
NS_IMETHOD WriteSegments (nsReadSegmentFun reader, void *closure, PRUint32 count, PRUint32 *_retval)
NS_IMETHOD IsNonBlocking (PRBool *aNonBlocking)
NS_IMETHOD GetURL (const char **result)
NS_IMETHOD GetEnd (PRUint32 *result)
NS_IMETHOD GetLastModified (PRUint32 *result)
NS_IMETHOD GetNotifyData (void **result)
NS_IMETHOD Close (void)
void close ()
 Close the stream.
void flush ()
 Flush the stream.
unsigned long write (in string aBuf, in unsigned long aCount)
 Write data into the stream.
unsigned long writeFrom (in nsIInputStream aFromStream, in unsigned long aCount)
 Writes data into the stream from an input stream.
unsigned long writeSegments (in nsReadSegmentFun aReader, in voidPtr aClosure, in unsigned long aCount)
 Low-level write method that has access to the stream's underlying buffer.
boolean isNonBlocking ()

Protected Attributes

NPP npp
NPStreampstream

Detailed Description

Definition at line 230 of file badapter.cpp.


Constructor & Destructor Documentation

Definition at line 1615 of file badapter.cpp.

    : npp(npp), pstream(pstr)
{
}

Definition at line 1620 of file badapter.cpp.

{
    //pstream = NULL;
    NPN_DestroyStream(npp, pstream, NPRES_DONE);
}

Here is the call graph for this function:


Member Function Documentation

void nsIOutputStream::close ( ) [inherited]

Close the stream.

Forces the output stream to flush any buffered data.

Exceptions:
NS_BASE_STREAM_WOULD_BLOCKif unable to flush without blocking the calling thread (non-blocking mode only)

Definition at line 1698 of file badapter.cpp.

{
    assert( pstream != NULL );

    return NS_OK;
}
void nsIOutputStream::flush ( ) [inherited]

Flush the stream.

Exceptions:
NS_BASE_STREAM_WOULD_BLOCKif unable to flush without blocking the calling thread (non-blocking mode only)

Definition at line 253 of file badapter.cpp.

                       {
        return NS_OK;
    }

Flushes the stream.

Definition at line 1659 of file badapter.cpp.

{
    assert( pstream != NULL );

    *result = pstream->end;
       return NS_OK;
}

Definition at line 1672 of file badapter.cpp.

Definition at line 1685 of file badapter.cpp.

{
    assert( pstream != NULL );

    *result = pstream->notifyData;
       return NS_OK;
}

Definition at line 1646 of file badapter.cpp.

{
    assert( pstream != NULL );

    *result = pstream->url;
       return NS_OK;
}
Returns:
true if stream is non-blocking

NOTE: writing to a blocking output stream will block the calling thread until all given data can be consumed by the stream.

Definition at line 527 of file BackwardAdapter.cpp.

                                        {
        NS_NOTREACHED("IsNonBlocking");
        return NS_ERROR_NOT_IMPLEMENTED;
    }
unsigned long nsIOutputStream::write ( in string  aBuf,
in unsigned long  aCount 
) [inherited]

Write data into the stream.

Parameters:
aBufthe buffer containing the data to be written
aCountthe maximum number of bytes to be written
Returns:
number of bytes written (may be less than aCount)
Exceptions:
NS_BASE_STREAM_WOULD_BLOCKif writing to the output stream would block the calling thread (non-blocking mode only)
<other-error>on failure
NS_METHOD CPluginManagerStream::Write ( const char *  aBuf,
PRUint32  aCount,
PRUint32 aWriteCount 
)

Write data into the stream.

Parameters:
aBufthe buffer into which the data is read
aCountthe maximum number of bytes to read
errorResultthe error code if an error occurs
Returns:
number of bytes read or -1 if error

Definition at line 1632 of file badapter.cpp.

{
    assert( npp != NULL );
    assert( pstream != NULL );

    *aWriteCount = NPN_Write(npp, pstream, len, (void* )buffer);
    return *aWriteCount >= 0 ? NS_OK : NS_ERROR_FAILURE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

NS_DECL_ISUPPORTS NS_IMETHOD CPluginManagerStream::Write ( const char *  aBuf,
PRUint32  aCount,
PRUint32 aWriteCount 
)

Write data into the stream.

Parameters:
aBufthe buffer into which the data is read
aCountthe maximum number of bytes to read
errorResultthe error code if an error occurs
Returns:
number of bytes read or -1 if error
NS_METHOD CPluginManagerStream::Write ( nsIInputStream fromStream,
PRUint32 aWriteCount 
)

Writes data into the stream from an input stream.

Implementer's note: This method is defined by this interface in order to allow the output stream to efficiently copy the data from the input stream into its internal buffer (if any). If this method was provide as an external facility, a separate char* buffer would need to be used in order to call the output stream's other Write method.

Parameters:
fromStreamthe stream from which the data is read
aWriteCountout parameter to hold the number of bytes written. if an error occurs, the writecount is undefined
Returns:
error status

Definition at line 2384 of file BackwardAdapter.cpp.

{
       nsresult rv = fromStream->Available(aWriteCount);
       if (rv == NS_OK) {
              char buffer[1024];
              PRUint32 len = *aWriteCount;
              while (len > 0) {           
                     PRUint32 count = (len < sizeof(buffer) ? len : sizeof(buffer));
                     rv = fromStream->Read(buffer, count, &count);
                     if (rv == NS_OK)
                            rv = Write(buffer, count, &count);
                     if (rv != NS_OK) {
                            *aWriteCount -= len;
                            break;
                     }
                     len -= count;
              }
       }
       return rv;
}

Here is the call graph for this function:

unsigned long nsIOutputStream::writeFrom ( in nsIInputStream  aFromStream,
in unsigned long  aCount 
) [inherited]

Writes data into the stream from an input stream.

Parameters:
aFromStreamthe stream containing the data to be written
aCountthe maximum number of bytes to be written
Returns:
number of bytes written (may be less than aCount)
Exceptions:
NS_BASE_STREAM_WOULD_BLOCKif writing to the output stream would block the calling thread (non-blocking mode only)
<other-error>on failure

NOTE: This method is defined by this interface in order to allow the output stream to efficiently copy the data from the input stream into its internal buffer (if any). If this method was provided as an external facility, a separate char* buffer would need to be used in order to call the output stream's other Write method.

NS_IMETHOD CPluginManagerStream::WriteFrom ( nsIInputStream inStr,
PRUint32  count,
PRUint32 _retval 
) [inline]

Definition at line 515 of file BackwardAdapter.cpp.

                                                                        {
        NS_NOTREACHED("WriteFrom");
        return NS_ERROR_NOT_IMPLEMENTED;
    }
unsigned long nsIOutputStream::writeSegments ( in nsReadSegmentFun  aReader,
in voidPtr  aClosure,
in unsigned long  aCount 
) [inherited]

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

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

Parameters:
aReaderthe "provider" of the data to be written
aClosureopaque parameter passed to reader
aCountthe maximum number of bytes to be written
Returns:
number of bytes written (may be less than aCount)
Exceptions:
NS_BASE_STREAM_WOULD_BLOCKif writing to the output 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 output stream).

NS_IMETHOD CPluginManagerStream::WriteSegments ( nsReadSegmentFun  reader,
void closure,
PRUint32  count,
PRUint32 _retval 
) [inline]

Definition at line 521 of file BackwardAdapter.cpp.

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

Member Data Documentation

Definition at line 285 of file badapter.cpp.

Definition at line 289 of file badapter.cpp.


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