Overview

Packages

  • None
  • thrift
    • transport

Classes

  • TBufferedTransport
  • TFramedTransport
  • THttpClient
  • TMemoryBuffer
  • TNullTransport
  • TPhpStream
  • TSocket
  • TSocketPool
  • TTransport
  • Overview
  • Package
  • Class
  • Tree

Class 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.

TTransport
Extended by TBufferedTransport
Package: thrift\transport
Author: Mark Slee mcslee@facebook.com
Located at Horde/Thrift/thrift_root/transport/TBufferedTransport.php
Methods summary
public
# __construct( mixed $transport = null, mixed $rBufSize = 512, mixed $wBufSize = 512 )

Constructor. Creates a buffered transport around an underlying transport

Constructor. Creates a buffered transport around an underlying transport

public boolean
# isOpen( )

Whether this transport is open.

Whether this transport is open.

Returns

boolean
true if open
public
# open( )

Open the transport for reading/writing

Open the transport for reading/writing

Throws

TTransportException
if cannot open
public
# close( )

Close the transport.

Close the transport.

public
# putBack( mixed $data )
public string
# readAll( mixed $len )

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.

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.

Returns

string
The data, of exact length

Throws

TTransportException
if cannot read data

Overrides

TTransport::readAll()
public string
# read( integer $len )

Read some data into the array.

Read some data into the array.

Parameters

$len
How much to read

Returns

string
The data that has been read

Throws

TTransportException
if cannot read any more data
public
# write( string $buf )

Writes the given data out.

Writes the given data out.

Parameters

$buf
The data to write

Throws

TTransportException
if writing fails
public
# flush( )

Flushes any pending data out of a buffer

Flushes any pending data out of a buffer

Throws

TTransportException
if a writing error occurs

Overrides

TTransport::flush()
API documentation generated by ApiGen