RawContentEncoder.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. * Handles raw Transfer Encoding in Swift Mailer.
  11. *
  12. *
  13. * @author Sebastiaan Stok <s.stok@rollerscapes.net>
  14. */
  15. class Swift_Mime_ContentEncoder_RawContentEncoder implements Swift_Mime_ContentEncoder
  16. {
  17. /**
  18. * Encode a given string to produce an encoded string.
  19. *
  20. * @param string $string
  21. * @param int $firstLineOffset ignored
  22. * @param int $maxLineLength ignored
  23. * @return string
  24. */
  25. public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0)
  26. {
  27. return $string;
  28. }
  29. /**
  30. * Encode stream $in to stream $out.
  31. *
  32. * @param Swift_OutputByteStream $in
  33. * @param Swift_InputByteStream $out
  34. * @param int $firstLineOffset ignored
  35. * @param int $maxLineLength ignored
  36. */
  37. public function encodeByteStream(Swift_OutputByteStream $os, Swift_InputByteStream $is, $firstLineOffset = 0, $maxLineLength = 0)
  38. {
  39. while (false !== ($bytes = $os->read(8192))) {
  40. $is->write($bytes);
  41. }
  42. }
  43. /**
  44. * Get the name of this encoding scheme.
  45. *
  46. * @return string
  47. */
  48. public function getName()
  49. {
  50. return 'raw';
  51. }
  52. /**
  53. * Not used.
  54. */
  55. public function charsetChanged($charset)
  56. {
  57. }
  58. }