IoBuffer.php 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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 extends Swift_InputByteStream, Swift_OutputByteStream
  16. {
  17. /** A socket buffer over TCP */
  18. const TYPE_SOCKET = 0x0001;
  19. /** A process buffer with I/O support */
  20. const TYPE_PROCESS = 0x0010;
  21. /**
  22. * Perform any initialization needed, using the given $params.
  23. * Parameters will vary depending upon the type of IoBuffer used.
  24. * @param array $params
  25. */
  26. public function initialize(array $params);
  27. /**
  28. * Set an individual param on the buffer (e.g. switching to SSL).
  29. * @param string $param
  30. * @param mixed $value
  31. */
  32. public function setParam($param, $value);
  33. /**
  34. * Perform any shutdown logic needed.
  35. */
  36. public function terminate();
  37. /**
  38. * Set an array of string replacements which should be made on data written
  39. * to the buffer. This could replace LF with CRLF for example.
  40. * @param string[] $replacements
  41. */
  42. public function setWriteTranslations(array $replacements);
  43. /**
  44. * Get a line of output (including any CRLF).
  45. * The $sequence number comes from any writes and may or may not be used
  46. * depending upon the implementation.
  47. * @param int $sequence of last write to scan from
  48. * @return string
  49. */
  50. public function readLine($sequence);
  51. }