IoBuffer.php 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. /*
  3. * This file is part of SwiftMailer.
  4. * (c) 2004-2009 Chris Corbyn
  5. *
  6. * For the full copyright and license information, please view the LICENSE
  7. * file that was distributed with this source code.
  8. */
  9. /**
  10. * Buffers input and output to a resource.
  11. * @package Swift
  12. * @subpackage Transport
  13. * @author Chris Corbyn
  14. */
  15. interface Swift_Transport_IoBuffer
  16. extends Swift_InputByteStream, Swift_OutputByteStream
  17. {
  18. /** A socket buffer over TCP */
  19. const TYPE_SOCKET = 0x0001;
  20. /** A process buffer with I/O support */
  21. const TYPE_PROCESS = 0x0010;
  22. /**
  23. * Perform any initialization needed, using the given $params.
  24. * Parameters will vary depending upon the type of IoBuffer used.
  25. * @param array $params
  26. */
  27. public function initialize(array $params);
  28. /**
  29. * Set an individual param on the buffer (e.g. switching to SSL).
  30. * @param string $param
  31. * @param mixed $value
  32. */
  33. public function setParam($param, $value);
  34. /**
  35. * Perform any shutdown logic needed.
  36. */
  37. public function terminate();
  38. /**
  39. * Set an array of string replacements which should be made on data written
  40. * to the buffer. This could replace LF with CRLF for example.
  41. * @param string[] $replacements
  42. */
  43. public function setWriteTranslations(array $replacements);
  44. /**
  45. * Get a line of output (including any CRLF).
  46. * The $sequence number comes from any writes and may or may not be used
  47. * depending upon the implementation.
  48. * @param int $sequence of last write to scan from
  49. * @return string
  50. */
  51. public function readLine($sequence);
  52. }