Manages attached stream filters for a MessagePart's content resource handle.

The attached stream filters are: o Content-Transfer-Encoding filter to manage decoding from a supported encoding: quoted-printable, base64 and x-uuencode. o Charset conversion filter to convert to UTF-8

author Zaahid Bateson
package MailMimeParser

 Methods

Sets up filter names used for stream_filter_append

__construct(\ZBateson\MailMimeParser\Stream\StreamFactory $streamFactory) 

Parameters

$streamFactory

\ZBateson\MailMimeParser\Stream\StreamFactory

Checks what transfer-encoding decoder stream is attached on the underlying stream, and resets it if the requested arguments differ.

getBinaryStream(string $transferEncoding) : \Psr\Http\Message\StreamInterface

Parameters

$transferEncoding

string

Returns

\Psr\Http\Message\StreamInterface

Checks what transfer-encoding decoder stream and charset conversion stream are currently attached on the underlying stream, and resets them if the requested arguments differ from the currently assigned ones.

getContentStream(string $transferEncoding, string $fromCharset, string $toCharset) : \Psr\Http\Message\StreamInterface

Parameters

$transferEncoding

string

$fromCharset

string

the character set the content is encoded in

$toCharset

string

the target encoding to return

Returns

\Psr\Http\Message\StreamInterface

Resets cached encoding and charset streams, and rewinds the stream.

reset() 

Sets the URL used to open the content resource handle.

setStream(\Psr\Http\Message\StreamInterface $stream = null

The function also closes the currently attached handle if any.

Parameters

$stream

\Psr\Http\Message\StreamInterface

Attaches a charset conversion filter to the attached content handle, for the passed arguments.

attachCharsetFilter(string $fromCharset, string $toCharset) 

Parameters

$fromCharset

string

the character set the content is encoded in

$toCharset

string

the target encoding to return

Attaches a decoding filter to the attached content handle, for the passed $transferEncoding.

attachTransferEncodingFilter(string $transferEncoding) 

Parameters

$transferEncoding

string

Returns true if the attached stream filter used for charset conversion on the current handle is different from the one needed based on the passed arguments.

isCharsetFilterChanged(string $fromCharset, string $toCharset) : boolean

Parameters

$fromCharset

string

$toCharset

string

Returns

boolean

Returns true if the attached stream filter used for decoding the content on the current handle is different from the one passed as an argument.

isTransferEncodingFilterChanged(string $transferEncoding) : boolean

Parameters

$transferEncoding

string

Returns

boolean

Resets just the charset stream, and rewinds the decodedStream.

resetCharsetStream() 

 Properties

 

the content stream after attaching charset streams to $binaryStream

$charsetStream : \Psr\Http\Message\StreamInterface

Default

 

the content stream after attaching transfer encoding streams to $stream.

$decodedStream : \Psr\Http\Message\StreamInterface

Default

 

the underlying content stream without filters applied

$stream : \Psr\Http\Message\StreamInterface

Default

 

map of the active charset filter on the current handle.

$charset : array

Default

array('from' => null, 'to' => null, 'filter' => null)
 

map of the active encoding filter on the current handle.

$encoding : array

Default

array('type' => null, 'filter' => null)
 

used to apply psr7 stream decorators to the attached StreamInterface based on encoding.

$streamFactory : \ZBateson\MailMimeParser\Stream\StreamFactory

Default