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
3.6.0

Interfaces, Classes, Traits and Enums

BufferInterface
SMTP buffer interface

Table of Contents

$sequence  : int
Write sequence
$filters  : array<string|int, mixed>
StreamFilters
$in  : resource
The input stream
$mirrors  : array<string|int, mixed>
Bound streams
$out  : resource
The output stream
$params  : mixed
Buffer initialization parameters $var array
$replacementFactory  : ReplacementFactoryInterface
The ReplacementFilterFactory
$stream  : resource
A primary socket
$translations  : array<string|int, mixed>
Translations performed on data being streamed into the buffer
$writeBuffer  : string
A buffer for writing
__construct()  : mixed
Create a new StreamBuffer using $replacementFactory for transformations.
addFilter()  : mixed
Add a StreamFilter to this InputByteStream
bind()  : mixed
Attach $is to this stream.
commit()  : mixed
For any bytes that are currently buffered inside the stream, force them off the buffer
flushBuffers()  : mixed
Flush the contents of the stream (empty it) and set the internal pointer to the beginning.
initialize()  : mixed
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()  : mixed
Remove an already present StreamFilter based on its $key
setParam()  : mixed
Set an individual param on the buffer (e.g. switching to SSL)
setReadPointer()  : bool|void
Not implemented
setWriteTranslations()  : mixed
Set an array of string replacements which should be made on data written to the buffer.
startTls()  : bool
Start TLS
terminate()  : mixed
Perform any shutdown logic needed
unbind()  : mixed
Remove an already bound stream.
write()  : int
Writes $bytes to the end of the stream
commitBytes()  : int
Write this bytes to the stream
flush()  : mixed
Flush the stream contents
doWrite()  : mixed
Just write the bytes to the stream
establishProcessConnection()  : mixed
Opens a process for input/output
establishSocketConnection()  : mixed
Establishes a connection to a remote server
filter()  : int
Run $bytes through all filters
getReadConnectionDescription()  : string
Get read connection description

Properties

$in

The input stream

private resource $in

$out

The output stream

private resource $out

$params

Buffer initialization parameters $var array

private mixed $params = []

$stream

A primary socket

private resource $stream

$translations

Translations performed on data being streamed into the buffer

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

Methods

commit()

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

public commit() : mixed
Return values
mixed

flushBuffers()

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

public flushBuffers() : mixed
Return values
mixed

initialize()

Perform any initialization needed, using the given $params.

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

Parameters will vary depending upon the type of IoBuffer used.

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

read()

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

public read(int $length) : string|bool

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
$length : int
Tags
throws
Exception
Return values
string|bool

readLine()

Get a line of output (including any CRLF).

public readLine(int $sequence) : string

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

Parameters
$sequence : int

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) : mixed
Parameters
$key : string
Return values
mixed

setParam()

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

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

setReadPointer()

Not implemented

public setReadPointer(int $byteOffset) : bool|void
Parameters
$byteOffset : int
Return values
bool|void

setWriteTranslations()

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

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

This could replace LF with CRLF for example.

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

startTls()

Start TLS

public startTls() : bool
Return values
bool

terminate()

Perform any shutdown logic needed

public terminate() : mixed
Return values
mixed

unbind()

Remove an already bound stream.

public unbind(InputInterface $is) : mixed

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
$is : InputInterface
Return values
mixed

write()

Writes $bytes to the end of the stream

public write(string $bytes) : int
Parameters
$bytes : string
Return values
int

commitBytes()

Write this bytes to the stream

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

flush()

Flush the stream contents

protected flush() : mixed
Return values
mixed

doWrite()

Just write the bytes to the stream

private doWrite(int $bytes) : mixed
Parameters
$bytes : int
Return values
mixed

establishProcessConnection()

Opens a process for input/output

private establishProcessConnection() : mixed
Return values
mixed

establishSocketConnection()

Establishes a connection to a remote server

private establishSocketConnection() : mixed
Return values
mixed

getReadConnectionDescription()

Get read connection description

private getReadConnectionDescription() : string
Return values
string

Search results