Back to index

d-push  2.0
Public Member Functions | Static Public Member Functions | Public Attributes | Private Attributes
MAPIStreamWrapper Class Reference

List of all members.

Public Member Functions

 stream_open ($path, $mode, $options, &$opened_path)
 Opens the stream The mapistream reference is passed over the context.
 stream_read ($len)
 Reads from stream.
 stream_tell ()
 Returns the current position on stream.
 stream_eof ()
 Indicates if 'end of file' is reached.

Static Public Member Functions

static Open ($mapistream)
 Instantiates a MAPIStreamWrapper.

Public Attributes

const PROTOCOL = "mapistream"

Private Attributes

 $mapistream
 $position
 $streamlength

Detailed Description

Definition at line 45 of file mapistreamwrapper.php.


Member Function Documentation

static MAPIStreamWrapper::Open ( mapistream) [static]

Instantiates a MAPIStreamWrapper.

Parameters:
mapistream$mapistreamThe stream to be wrapped

public

Returns:
MAPIStreamWrapper

Definition at line 125 of file mapistreamwrapper.php.

                                              {
        $context = stream_context_create(array(self::PROTOCOL => array('stream' => &$mapistream)));
        return fopen(self::PROTOCOL . "://",'r', false, $context);
    }

Indicates if 'end of file' is reached.

public

Returns:
boolean

Definition at line 113 of file mapistreamwrapper.php.

                                 {
        return ($this->position >= $this->streamlength);
    }
MAPIStreamWrapper::stream_open ( path,
mode,
options,
&$  opened_path 
)

Opens the stream The mapistream reference is passed over the context.

Parameters:
string$pathSpecifies the URL that was passed to the original function
string$modeThe mode used to open the file, as detailed for fopen()
int$optionsHolds additional flags set by the streams API
string$opened_pathIf the path is opened successfully, and STREAM_USE_PATH is set in options, opened_path should be set to the full path of the file/resource that was actually opened.

public

Returns:
boolean

Definition at line 65 of file mapistreamwrapper.php.

                                                                       {
        $contextOptions = stream_context_get_options($this->context);
        if (!isset($contextOptions[self::PROTOCOL]['stream']))
            return false;

        $this->position = 0;

        // this is our stream!
        $this->mapistream = $contextOptions[self::PROTOCOL]['stream'];

        // get the data length from mapi
        $stat = mapi_stream_stat($this->mapistream);
        $this->streamlength = $stat["cb"];
        ZLog::Write(LOGLEVEL_DEBUG, sprintf("MAPIStreamWrapper::stream_open(): initialized mapistream: %s streamlength: %d", $this->mapistream, $this->streamlength));

        return true;
    }

Here is the call graph for this function:

Reads from stream.

Parameters:
int$lenamount of bytes to be read

public

Returns:
string

Definition at line 91 of file mapistreamwrapper.php.

                                      {
        $data = mapi_stream_read($this->mapistream, $len);
        $this->position += strlen($data);
        return $data;
    }

Returns the current position on stream.

public

Returns:
int

Definition at line 103 of file mapistreamwrapper.php.

                                  {
        return $this->position;
    }

Member Data Documentation

Definition at line 48 of file mapistreamwrapper.php.

Definition at line 49 of file mapistreamwrapper.php.

Definition at line 50 of file mapistreamwrapper.php.

const MAPIStreamWrapper::PROTOCOL = "mapistream"

Definition at line 46 of file mapistreamwrapper.php.


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