XOOPS RMCommon Utilities  2.1.8.91RC
 All Classes Namespaces Files Functions Variables
SimpleKeyCacheInputStream.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of SwiftMailer.
5  * (c) 2004-2009 Chris Corbyn
6  *
7  * For the full copyright and license information, please view the LICENSE
8  * file that was distributed with this source code.
9  */
10 
11 //@require 'Swift/KeyCache.php';
12 //@require 'Swift/KeyCacheInputStream.php';
13 
22 {
23 
25  private $_keyCache;
26 
28  private $_nsKey;
29 
31  private $_itemKey;
32 
34  private $_writeThrough = null;
35 
40  public function setKeyCache(Swift_KeyCache $keyCache)
41  {
42  $this->_keyCache = $keyCache;
43  }
44 
50  {
51  $this->_writeThrough = $is;
52  }
53 
59  public function write($bytes, Swift_InputByteStream $is = null)
60  {
61  $this->_keyCache->setString(
62  $this->_nsKey, $this->_itemKey, $bytes, Swift_KeyCache::MODE_APPEND
63  );
64  if (isset($is))
65  {
66  $is->write($bytes);
67  }
68  if (isset($this->_writeThrough))
69  {
70  $this->_writeThrough->write($bytes);
71  }
72  }
73 
77  public function commit()
78  {
79  }
80 
84  public function bind(Swift_InputByteStream $is)
85  {
86  }
87 
91  public function unbind(Swift_InputByteStream $is)
92  {
93  }
94 
99  public function flushBuffers()
100  {
101  $this->_keyCache->clearKey($this->_nsKey, $this->_itemKey);
102  }
103 
108  public function setNsKey($nsKey)
109  {
110  $this->_nsKey = $nsKey;
111  }
112 
117  public function setItemKey($itemKey)
118  {
119  $this->_itemKey = $itemKey;
120  }
121 
126  public function __clone()
127  {
128  $this->_writeThrough = null;
129  }
130 
131 }