public function __construct($data, array $opts = array())
{
/* String data is stored in a stream. */
$this->_data = new Horde_Stream_Temp();
if (empty($opts['skipscan'])) {
$this->_filter = $this->_filterParams();
stream_filter_register('horde_imap_client_string', 'Horde_Imap_Client_Data_Format_Filter_String');
$res = stream_filter_append($this->_data->stream, 'horde_imap_client_string', STREAM_FILTER_WRITE, $this->_filter);
} else {
$res = null;
}
if (empty($opts['eol'])) {
$res2 = null;
} else {
stream_filter_register('horde_eol', 'Horde_Stream_Filter_Eol');
$res2 = stream_filter_append($this->_data->stream, 'horde_eol', STREAM_FILTER_WRITE);
}
$this->_data->add($data);
if (!is_null($res)) {
stream_filter_remove($res);
}
if (!is_null($res2)) {
stream_filter_remove($res2);
}
if (isset($this->_filter) && $this->_filter->nonascii && !$this instanceof Horde_Imap_Client_Data_Format_String_Support_Nonascii) {
throw new Horde_Imap_Client_Data_Format_Exception('String contains non-ASCII characters.');
}
}