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_once dirname(__FILE__) . '/OutputByteStream.php';
12: require_once dirname(__FILE__) . '/CharacterReaderFactory.php';
13:
14: /**
15: * An abstract means of reading and writing data in terms of characters as opposed
16: * to bytes.
17: * Classes implementing this interface may use a subsystem which requires less
18: * memory than working with large strings of data.
19: * @package Swift
20: * @subpackage CharacterStream
21: * @author Chris Corbyn
22: */
23: interface Swift_CharacterStream
24: {
25: /**
26: * Set the character set used in this CharacterStream.
27: * @param string $charset
28: */
29: public function setCharacterSet($charset);
30:
31: /**
32: * Set the CharacterReaderFactory for multi charset support.
33: * @param Swift_CharacterReaderFactory $factory
34: */
35: public function setCharacterReaderFactory(Swift_CharacterReaderFactory $factory);
36:
37: /**
38: * Overwrite this character stream using the byte sequence in the byte stream.
39: * @param Swift_OutputByteStream $os output stream to read from
40: */
41: public function importByteStream(Swift_OutputByteStream $os);
42:
43: /**
44: * Import a string a bytes into this CharacterStream, overwriting any existing
45: * data in the stream.
46: * @param string $string
47: */
48: public function importString($string);
49:
50: /**
51: * Read $length characters from the stream and move the internal pointer
52: * $length further into the stream.
53: * @param int $length
54: * @return string
55: */
56: public function read($length);
57:
58: /**
59: * Read $length characters from the stream and return a 1-dimensional array
60: * containing there octet values.
61: * @param int $length
62: * @return int[]
63: */
64: public function readBytes($length);
65:
66: /**
67: * Write $chars to the end of the stream.
68: * @param string $chars
69: */
70: public function write($chars);
71:
72: /**
73: * Move the internal pointer to $charOffset in the stream.
74: * @param int $charOffset
75: */
76: public function setPointer($charOffset);
77:
78: /**
79: * Empty the stream and reset the internal pointer.
80: */
81: public function flushContents();
82: }
83: