TYPO3 API  SVNRelease
CharacterStream.php
Go to the documentation of this file.
00001 <?php
00002 
00003 /*
00004  * This file is part of SwiftMailer.
00005  * (c) 2004-2009 Chris Corbyn
00006  *
00007  * For the full copyright and license information, please view the LICENSE
00008  * file that was distributed with this source code.
00009  */
00010 
00011 require_once dirname(__FILE__) . '/OutputByteStream.php';
00012 require_once dirname(__FILE__) . '/CharacterReaderFactory.php';
00013 
00014 
00015 /**
00016  * An abstract means of reading and writing data in terms of characters as opposed
00017  * to bytes.
00018  * Classes implementing this interface may use a subsystem which requires less
00019  * memory than working with large strings of data.
00020  * @package Swift
00021  * @subpackage CharacterStream
00022  * @author Chris Corbyn
00023  */
00024 interface Swift_CharacterStream
00025 {
00026 
00027   /**
00028    * Set the character set used in this CharacterStream.
00029    * @param string $charset
00030    */
00031   public function setCharacterSet($charset);
00032 
00033   /**
00034    * Set the CharacterReaderFactory for multi charset support.
00035    * @param Swift_CharacterReaderFactory $factory
00036    */
00037   public function setCharacterReaderFactory(
00038     Swift_CharacterReaderFactory $factory);
00039 
00040   /**
00041    * Overwrite this character stream using the byte sequence in the byte stream.
00042    * @param Swift_OutputByteStream $os output stream to read from
00043    */
00044   public function importByteStream(Swift_OutputByteStream $os);
00045 
00046   /**
00047    * Import a string a bytes into this CharacterStream, overwriting any existing
00048    * data in the stream.
00049    * @param string $string
00050    */
00051   public function importString($string);
00052 
00053   /**
00054    * Read $length characters from the stream and move the internal pointer
00055    * $length further into the stream.
00056    * @param int $length
00057    * @return string
00058    */
00059   public function read($length);
00060 
00061   /**
00062    * Read $length characters from the stream and return a 1-dimensional array
00063    * containing there octet values.
00064    * @param int $length
00065    * @return int[]
00066    */
00067   public function readBytes($length);
00068 
00069   /**
00070    * Write $chars to the end of the stream.
00071    * @param string $chars
00072    */
00073   public function write($chars);
00074 
00075   /**
00076    * Move the internal pointer to $charOffset in the stream.
00077    * @param int $charOffset
00078    */
00079   public function setPointer($charOffset);
00080 
00081   /**
00082    * Empty the stream and reset the internal pointer.
00083    */
00084   public function flushContents();
00085 
00086 }