public function copyBodyStream($sourceStream, $maxlength = null, $offset = 0)
    {

        // check if a stream has been passed
        if (is_resource($sourceStream)) {
            if ($offset && $maxlength) {
                $this->bodyStream = stream_get_contents($sourceStream, $maxlength, $offset);
            }
            if (!$offset && $maxlength) {
                $this->bodyStream = stream_get_contents($sourceStream, $maxlength);
            }
            if (!$offset && !$maxlength) {
                $this->bodyStream = stream_get_contents($sourceStream);
            }
        } else {
            // if not, copy the string
            $this->bodyStream = substr($sourceStream, $offset, $maxlength);
        }

        // return the string length
        return strlen($this->bodyStream);
    }
public function copyBodyStream($sourceStream, $maxlength = null, $offset = 0)
    {

        // check if a stream has been passed
        if (is_resource($sourceStream)) {
            if ($offset && $maxlength) {
                $this->bodyStream = stream_get_contents($sourceStream, $maxlength, $offset);
            }
            if (!$offset && $maxlength) {
                $this->bodyStream = stream_get_contents($sourceStream, $maxlength);
            }
            if (!$offset && !$maxlength) {
                $this->bodyStream = stream_get_contents($sourceStream);
            }
        } else {
            // if not, copy the string
            $this->bodyStream = substr($sourceStream, $offset, $maxlength);
        }

        // return the string length
        return strlen($this->bodyStream);
    }
public function copyBodyStream ( $ sourceStream , $ maxlength = null , $ offset = 0 ) { // check if a stream has been passed if ( is_resource ( $ sourceStream ) ) { if ( $ offset && $ maxlength ) { $ this -> bodyStream = stream_get_contents ( $ sourceStream , $ maxlength , $ offset ) ; } if ( ! $ offset && $ maxlength ) { $ this -> bodyStream = stream_get_contents ( $ sourceStream , $ maxlength ) ; } if ( ! $ offset && ! $ maxlength ) { $ this -> bodyStream = stream_get_contents ( $ sourceStream ) ; } } else { // if not, copy the string $ this -> bodyStream = substr ( $ sourceStream , $ offset , $ maxlength ) ; } // return the string length return strlen ( $ this -> bodyStream ) ; }
Copies a source stream to body stream.

@param resource $sourceStream The file pointer to source stream
@param integer  $maxlength    The max length to read from source stream
@param integer  $offset       The offset from source stream to read

@return integer The total number of bytes copied
Copies a source stream to body stream .