4 * This file is part of SwiftMailer.
5 * (c) 2004-2009 Chris Corbyn
7 * For the full copyright and license information, please view the LICENSE
8 * file that was distributed with this source code.
11 require_once dirname(__FILE__
) . '/OutputByteStream.php';
12 require_once dirname(__FILE__
) . '/CharacterReaderFactory.php';
16 * An abstract means of reading and writing data in terms of characters as opposed
18 * Classes implementing this interface may use a subsystem which requires less
19 * memory than working with large strings of data.
21 * @subpackage CharacterStream
22 * @author Chris Corbyn
24 interface Swift_CharacterStream
28 * Set the character set used in this CharacterStream.
29 * @param string $charset
31 public function setCharacterSet($charset);
34 * Set the CharacterReaderFactory for multi charset support.
35 * @param Swift_CharacterReaderFactory $factory
37 public function setCharacterReaderFactory(
38 Swift_CharacterReaderFactory
$factory);
41 * Overwrite this character stream using the byte sequence in the byte stream.
42 * @param Swift_OutputByteStream $os output stream to read from
44 public function importByteStream(Swift_OutputByteStream
$os);
47 * Import a string a bytes into this CharacterStream, overwriting any existing
49 * @param string $string
51 public function importString($string);
54 * Read $length characters from the stream and move the internal pointer
55 * $length further into the stream.
59 public function read($length);
62 * Read $length characters from the stream and return a 1-dimensional array
63 * containing there octet values.
67 public function readBytes($length);
70 * Write $chars to the end of the stream.
71 * @param string $chars
73 public function write($chars);
76 * Move the internal pointer to $charOffset in the stream.
77 * @param int $charOffset
79 public function setPointer($charOffset);
82 * Empty the stream and reset the internal pointer.
84 public function flushContents();