TYPO3 API  SVNRelease
InputByteStream.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 /**
00012  * An abstract means of writing data.
00013  * Classes implementing this interface may use a subsystem which requires less
00014  * memory than working with large strings of data.
00015  * @package Swift
00016  * @subpackage ByteStream
00017  * @author Chris Corbyn
00018  */
00019 interface Swift_InputByteStream
00020 {
00021 
00022   /**
00023    * Writes $bytes to the end of the stream.
00024    *
00025    * Writing may not happen immediately if the stream chooses to buffer.  If
00026    * you want to write these bytes with immediate effect, call {@link commit()}
00027    * after calling write().
00028    *
00029    * This method returns the sequence ID of the write (i.e. 1 for first, 2 for
00030    * second, etc etc).
00031    *
00032    * @param string $bytes
00033    * @return int
00034    * @throws Swift_IoException
00035    */
00036   public function write($bytes);
00037 
00038   /**
00039    * For any bytes that are currently buffered inside the stream, force them
00040    * off the buffer.
00041    *
00042    * @throws Swift_IoException
00043    */
00044   public function commit();
00045 
00046   /**
00047    * Attach $is to this stream.
00048    * The stream acts as an observer, receiving all data that is written.
00049    * All {@link write()} and {@link flushBuffers()} operations will be mirrored.
00050    *
00051    * @param Swift_InputByteStream $is
00052    */
00053   public function bind(Swift_InputByteStream $is);
00054 
00055   /**
00056    * Remove an already bound stream.
00057    * If $is is not bound, no errors will be raised.
00058    * If the stream currently has any buffered data it will be written to $is
00059    * before unbinding occurs.
00060    *
00061    * @param Swift_InputByteStream $is
00062    */
00063   public function unbind(Swift_InputByteStream $is);
00064 
00065   /**
00066    * Flush the contents of the stream (empty it) and set the internal pointer
00067    * to the beginning.
00068    * @throws Swift_IoException
00069    */
00070   public function flushBuffers();
00071 
00072 }