\TBufferedTransport

Buffered transport. Stores data to an internal buffer that it doesn't actually write out until flush is called. For reading, we do a greedy read and then serve data out of the internal buffer.

Summary

Methods
Properties
Constants
isOpen()
open()
close()
read()
readAll()
write()
flush()
__construct()
putBack()
No public properties found
No constants found
No protected methods found
$transport_
$rBufSize_
$wBufSize_
$wBuf_
$rBuf_
N/A
No private methods found
No private properties found
N/A

Properties

$transport_

$transport_ : \TTransport

The underlying transport

Type

\TTransport

$rBufSize_

$rBufSize_ : integer

The receive buffer size

Type

integer

$wBufSize_

$wBufSize_ : integer

The write buffer size

Type

integer

$wBuf_

$wBuf_ : string

The write buffer.

Type

string

$rBuf_

$rBuf_ : string

The read buffer.

Type

string

Methods

isOpen()

isOpen() : boolean

Whether this transport is open.

Returns

boolean —

true if open

open()

open() 

Open the transport for reading/writing

close()

close() 

Close the transport.

read()

read(integer  $len) : string

Read some data into the array.

Parameters

integer $len

How much to read

Returns

string —

The data that has been read

readAll()

readAll(  $len) : string

The reason that we customize readAll here is that the majority of PHP streams are already internally buffered by PHP. The socket stream, for example, buffers internally and blocks if you call read with $len greater than the amount of data available, unlike recv() in C.

Therefore, use the readAll method of the wrapped transport inside the buffered readAll.

Parameters

$len

Returns

string —

The data, of exact length

write()

write(string  $buf) 

Writes the given data out.

Parameters

string $buf

The data to write

flush()

flush() 

Flushes any pending data out of a buffer

__construct()

__construct(  $transport = null,   $rBufSize = 512,   $wBufSize = 512) 

Constructor. Creates a buffered transport around an underlying transport

Parameters

$transport
$rBufSize
$wBufSize

putBack()

putBack(  $data) 

Parameters

$data