\TFramedTransport

Framed transport. Writes and reads data in chunks that are stamped with their length.

Summary

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

Properties

$transport_

$transport_ : \TTransport

Underlying transport object.

Type

\TTransport

$rBuf_

$rBuf_ : string

Buffer for read data.

Type

string

$wBuf_

$wBuf_ : string

Buffer for queued output data

Type

string

$read_

$read_ : boolean

Whether to frame reads

Type

boolean

$write_

$write_ : boolean

Whether to frame writes

Type

boolean

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

Reads from the buffer. When more data is required reads another entire chunk and serves future reads out of that.

Parameters

integer $len

How much data

Returns

string —

The data that has been read

readAll()

readAll(  $len) : string

Guarantees that the full amount of data is read.

Parameters

$len

Throws

\TTransportException

if cannot read data

Returns

string —

The data, of exact length

write()

write(string  $buf, integer  $len = null) 

Writes some data to the pending output buffer.

Parameters

string $buf

The data

integer $len

Limit of bytes to write

flush()

flush() 

Writes the output buffer to the stream in the format of a 4-byte length followed by the actual data.

__construct()

__construct(\TTransport  $transport = null,   $read = true,   $write = true) 

Constructor.

Parameters

\TTransport $transport

Underlying transport

$read
$write

putBack()

putBack(string  $data) 

Put previously read data back into the buffer

Parameters

string $data

data to return

readFrame()

readFrame() 

Reads a chunk of data into the internal read buffer.