/** * Return a 8bit string from a file * @param Swift_File The file stream to read from * @param int Max line length (including CRLF) * @param string The line ending * @return Swift_Cache_OutputStream * @throws Swift_FileException If the file cannot be read */ public function encode8BitFile(Swift_File $file, $chunk = 76, $le = "\r\n") { Swift_ClassLoader::load("Swift_CacheFactory"); $cache = Swift_CacheFactory::getCache(); $ret = ""; while (false !== ($bytes = $file->read(8192))) { $ret .= $bytes; } $cache->write("8b", $this->fixLE(wordwrap($ret, $chunk - 2, $le, 1), $le)); return $cache->getOutputStream("8b"); }
/** * Return a 8bit string from a file * @param Swift_File The file stream to read from * @param int Max line length (including CRLF) * @param string The line ending * @return string * @throws Swift_FileException If the file cannot be read */ function &encode8BitFile($file, $chunk = 76, $le = "\r\n") { Swift_ClassLoader::load("Swift_CacheFactory"); if (!is_a($file, "Swift_File")) { trigger_error("The file passed MUST be an instance of Swift_File."); return; } $cache =& Swift_CacheFactory::getCache(); $ret = ""; while (false !== ($bytes = $file->read(8192))) { $ret .= $bytes; } $cache->write("8b", $this->fixLE(wordwrap($ret, $chunk - 2, $le, 1), $le)); $os =& $cache->getOutputStream("8b"); return $os; }
/** * Constructor */ public function __construct() { Swift_ClassLoader::load("Swift_Message_Headers"); $this->setHeaders(new Swift_Message_Headers()); Swift_ClassLoader::load("Swift_CacheFactory"); $this->cache = Swift_CacheFactory::getCache(); }
/** * Constructor */ function Swift_Message_Mime() { Swift_ClassLoader::load("Swift_Message_Encoder"); $this->_encoder =& Swift_Message_Encoder::instance(); Swift_ClassLoader::load("Swift_Message_Headers"); $headers =& new Swift_Message_Headers(); $this->setHeaders($headers); Swift_ClassLoader::load("Swift_CacheFactory"); $this->cache =& Swift_CacheFactory::getCache(); }