IoBuffer.php 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. *
  12. * @package Swift
  13. * @subpackage Transport
  14. * @author Chris Corbyn
  15. */
  16. interface Swift_Transport_IoBuffer 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. *
  25. * Parameters will vary depending upon the type of IoBuffer used.
  26. *
  27. * @param array $params
  28. */
  29. public function initialize(array $params);
  30. /**
  31. * Set an individual param on the buffer (e.g. switching to SSL).
  32. *
  33. * @param string $param
  34. * @param mixed $value
  35. */
  36. public function setParam($param, $value);
  37. /**
  38. * Perform any shutdown logic needed.
  39. */
  40. public function terminate();
  41. /**
  42. * Set an array of string replacements which should be made on data written
  43. * to the buffer.
  44. *
  45. * This could replace LF with CRLF for example.
  46. *
  47. * @param string[] $replacements
  48. */
  49. public function setWriteTranslations(array $replacements);
  50. /**
  51. * Get a line of output (including any CRLF).
  52. *
  53. * The $sequence number comes from any writes and may or may not be used
  54. * depending upon the implementation.
  55. *
  56. * @param integer $sequence of last write to scan from
  57. *
  58. * @return string
  59. */
  60. public function readLine($sequence);
  61. }