Documentation

Buffer extends AbstractFilterableInputStream
in package
implements BufferInterface

Stream buffer class

Tags
category

Pop

author

Chris Corbyn, from the SwiftMailer library https://github.com/swiftmailer/swiftmailer

version
4.0.0

Table of Contents

Interfaces

BufferInterface
SMTP buffer interface

Properties

$sequence  : int
Write sequence
$filters  : array<string|int, mixed>
StreamFilters
$in  : mixed
The input stream
$mirrors  : array<string|int, mixed>
Bound streams
$out  : mixed
The output stream
$params  : array<string|int, mixed>
Buffer initialization parameters $var array
$replacementFactory  : ReplacementFactoryInterface
The ReplacementFilterFactory
$stream  : mixed
A primary socket
$translations  : array<string|int, mixed>
Translations performed on data being streamed into the buffer
$writeBuffer  : string
A buffer for writing

Methods

__construct()  : mixed
Create a new StreamBuffer using $replacementFactory for transformations.
addFilter()  : void
Add a StreamFilter to this InputByteStream
bind()  : void
Attach $is to this stream.
commit()  : void
For any bytes that are currently buffered inside the stream, force them off the buffer
flushBuffers()  : void
Flush the contents of the stream (empty it) and set the internal pointer to the beginning.
initialize()  : void
Perform any initialization needed, using the given $params.
read()  : string|bool
Reads $length bytes from the stream into a string and moves the pointer through the stream by $length.
readLine()  : string
Get a line of output (including any CRLF).
removeFilter()  : void
Remove an already present StreamFilter based on its $key
setParam()  : void
Set an individual param on the buffer (e.g. switching to SSL)
setReadPointer()  : void
Not implemented
setWriteTranslations()  : void
Set an array of string replacements which should be made on data written to the buffer.
startTls()  : bool
Start TLS
terminate()  : void
Perform any shutdown logic needed
unbind()  : void
Remove an already bound stream.
write()  : mixed
Writes $bytes to the end of the stream
commitBytes()  : int
Write bytes to the stream
flush()  : void
Flush the stream contents
doWrite()  : void
Just write the bytes to the stream
establishProcessConnection()  : void
Opens a process for input/output
establishSocketConnection()  : void
Establishes a connection to a remote server
filter()  : mixed
Run $bytes through all filters
getReadConnectionDescription()  : string
Get read connection description

Properties

$in

The input stream

private mixed $in

$out

The output stream

private mixed $out

$params

Buffer initialization parameters $var array

private array<string|int, mixed> $params = []

$stream

A primary socket

private mixed $stream

$translations

Translations performed on data being streamed into the buffer

private array<string|int, mixed> $translations = []

Methods

flushBuffers()

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

public flushBuffers() : void

initialize()

Perform any initialization needed, using the given $params.

public initialize(array<string|int, mixed> $params) : void

Parameters will vary depending upon the type of IoBuffer used.

Parameters
$params : array<string|int, mixed>

read()

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

public read(int|string $length) : string|bool

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

Parameters
$length : int|string
Tags
throws
Exception
Return values
string|bool

readLine()

Get a line of output (including any CRLF).

public readLine(int|string $sequence) : string

The $sequence number comes from any writes and may or may not be used depending upon the implementation.

Parameters
$sequence : int|string

of last write to scan from

Tags
throws
Exception
Return values
string

removeFilter()

Remove an already present StreamFilter based on its $key

public removeFilter(string $key) : void
Parameters
$key : string

setParam()

Set an individual param on the buffer (e.g. switching to SSL)

public setParam(string $param, mixed $value) : void
Parameters
$param : string
$value : mixed

setReadPointer()

Not implemented

public setReadPointer(int|string $byteOffset) : void
Parameters
$byteOffset : int|string

setWriteTranslations()

Set an array of string replacements which should be made on data written to the buffer.

public setWriteTranslations(array<string|int, mixed> $replacements) : void

This could replace LF with CRLF for example.

Parameters
$replacements : array<string|int, mixed>

startTls()

Start TLS

public startTls() : bool
Return values
bool

terminate()

Perform any shutdown logic needed

public terminate() : void

commitBytes()

Write bytes to the stream

protected commitBytes(string $bytes) : int
Parameters
$bytes : string
Return values
int

flush()

Flush the stream contents

protected flush() : void

establishProcessConnection()

Opens a process for input/output

private establishProcessConnection() : void

establishSocketConnection()

Establishes a connection to a remote server

private establishSocketConnection() : void

getReadConnectionDescription()

Get read connection description

private getReadConnectionDescription() : string
Return values
string

        
On this page

Search results