Properties

$sequence

$sequence : integer

Write sequence

Type

integer

$offset

$offset : integer

The internal pointer offset

Type

integer

$path

$path : string

The path to the file

Type

string

$mode

$mode : string

The mode this file is opened in for writing

Type

string

$reader

$reader : resource

A lazy-loaded resource handle for reading the file

Type

resource

$writer

$writer : resource

A lazy-loaded resource handle for writing the file

Type

resource

$seekable

$seekable : 

If stream is seekable true/false, or null if not known

Type

$filters

$filters : array

StreamFilters

Type

array

$writeBuffer

$writeBuffer : string

A buffer for writing

Type

string

$mirrors

$mirrors : array

Bound streams

Type

array

Methods

__construct()

__construct() 

Create a new TemporaryFileByteStream

Throws

\Pop\Mail\Transport\Smtp\Stream\Byte\Exception

getPath()

getPath() : string

Get the complete path to the file

Returns

string

read()

read(integer  $length) : string|boolean

Reads $length bytes from the stream into a string and moves the pointer through the stream by $length.

If less bytes exist than are requested the remaining bytes are given instead. If no bytes are remaining at all, boolean false is returned.

Parameters

integer $length

Throws

\Pop\Mail\Transport\Smtp\Stream\Byte\Exception

Returns

string|boolean

setReadPointer()

setReadPointer(integer  $byteOffset) : boolean

Move the internal read pointer to $byteOffset in the stream

Parameters

integer $byteOffset

Returns

boolean

removeFilter()

removeFilter(string  $key) 

Remove an already present StreamFilter based on its $key

Parameters

string $key

write()

write(string  $bytes) : integer

Writes $bytes to the end of the stream

Writing may not happen immediately if the stream chooses to buffer. If you want to write these bytes with immediate effect, call \commit() after calling write().

This method returns the sequence ID of the write (i.e. 1 for first, 2 for second, etc etc).

Parameters

string $bytes

Returns

integer

commit()

commit() 

For any bytes that are currently buffered inside the stream, force them off the buffer

bind()

bind(\Pop\Mail\Transport\Smtp\Stream\Byte\InputInterface  $is) 

Attach $is to this stream.

The stream acts as an observer, receiving all data that is written. All \write() and \flushBuffers() operations will be mirrored.

Parameters

\Pop\Mail\Transport\Smtp\Stream\Byte\InputInterface $is

unbind()

unbind(\Pop\Mail\Transport\Smtp\Stream\Byte\InputInterface  $is) 

Remove an already bound stream.

If $is is not bound, no errors will be raised. If the stream currently has any buffered data it will be written to $is before unbinding occurs.

Parameters

\Pop\Mail\Transport\Smtp\Stream\Byte\InputInterface $is

flushBuffers()

flushBuffers() 

Flush the contents of the stream (empty it) and set the internal pointer to the beginning.

getContent()

getContent() : string

Get content

Throws

\Pop\Mail\Transport\Smtp\Stream\Byte\Exception

Returns

string

__destruct()

__destruct() 

Destructor

commitBytes()

commitBytes(string  $bytes) 

Commit the given bytes to the storage medium immediately

Parameters

string $bytes

flush()

flush() 

Flush any buffers/content with immediate effect

getReadHandle()

getReadHandle() : resource

Get the resource for reading

Throws

\Pop\Mail\Transport\Smtp\Stream\Byte\Exception

Returns

resource

getWriteHandle()

getWriteHandle() : resource

Get the resource for writing

Throws

\Pop\Mail\Transport\Smtp\Stream\Byte\Exception

Returns

resource

resetReadHandle()

resetReadHandle() 

Force a reload of the resource for reading

getReadStreamSeekableStatus()

getReadStreamSeekableStatus() 

Check if ReadOnly Stream is seekable

seekReadStreamToPosition()

seekReadStreamToPosition(integer  $offset) 

Streams in a readOnly stream ensuring copy if needed

Parameters

integer $offset

copyReadStream()

copyReadStream() 

Copy a readOnly Stream to ensure seekability

filter()

filter(integer  $bytes) : integer

Run $bytes through all filters

Parameters

integer $bytes

Returns

integer

doWrite()

doWrite(integer  $bytes) 

Just write the bytes to the stream

Parameters

integer $bytes