32 $this->_charStream = $charStream;
45 public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0)
50 $currentLine = &$lines[$lineCount++];
52 if (0 >= $maxLineLength) {
56 $this->_charStream->flushContents();
57 $this->_charStream->importString($string);
59 $thisLineLength = $maxLineLength - $firstLineOffset;
61 while (
false !== $char = $this->_charStream->read(4)) {
62 $encodedChar = rawurlencode($char);
63 if (0 != strlen($currentLine)
64 && strlen($currentLine.$encodedChar) > $thisLineLength) {
66 $currentLine = &$lines[$lineCount++];
67 $thisLineLength = $maxLineLength;
69 $currentLine .= $encodedChar;
72 return implode(
"\r\n", $lines);
82 $this->_charStream->setCharacterSet($charset);