Location: PHPKode > scripts > Recover Stream > recover-stream/RecoverStringStream.class.php
<?php 

require_once(dirname(__FILE__) . '/RecoverStream.class.php');

class RecoverStringStream extends RecoverStream {

	var $FileName    = '';
	var $Content     = '';
	var $ContentType = '';
	var $_offset     = 0;
	
	function RecoverStringStream() {
		$this->__constructor();
	} 
	
	function __constructor() {
		parent::__constructor();
	}
	
	function Open() {
		return true;
	}
	
	function Close() {
		return false;
	}

	function Seek($offset) {
		$this->_offset = $offset;
		return true;
	}

	function Read($length) {
		$result = substr($this->Content, $this->_offset, $length);
		$this->_offset += $length;
		return $result;
	}
	
	function ContentType() {
		return $this->ContentType;
	}

	function ContentLength() {
		return strlen($this->Content);
	}
	
	function AdditionalHeaders() {
		return array('Content-Disposition: attachment; filename="' . $this->FileName . '"');
	}

}

?>
Return current item: Recover Stream