PHP Класс TQ\Vcs\Buffer\StringBuffer

Наследование: implements TQ\Vcs\Buffer\FileBufferInterface
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$buffer string The buffer contents
$length integer The buffer length
$mode string The read/write mode
$objectInfo array The object info if available
$position integer The current pointer position

Открытые методы

Метод Описание
__construct ( string $buffer, array $objectInfo = [], string $mode = 'r+' ) Creates a new file buffer with the given contents
close ( ) Closes the buffer
flush ( ) : boolean Flushes the buffer to the storage media
getBuffer ( ) : string Returns the complete contents of the buffer
getLength ( ) : integer Returns the current length
getPosition ( ) : integer Returns the current pointer position
getStat ( ) : array Returns the stat information for the buffer
isEof ( ) : boolean Returns true if the pointer is at the end of the buffer
read ( integer $count ) : string | null Reads $count bytes from the buffer
setPosition ( integer $position, integer $whence ) : boolean Sets the pointer position
write ( string $data ) : integer Writes the given date into the buffer at the current pointer position

Описание методов

__construct() публичный Метод

Creates a new file buffer with the given contents
public __construct ( string $buffer, array $objectInfo = [], string $mode = 'r+' )
$buffer string The buffer content
$objectInfo array The object info
$mode string The file mode

close() публичный Метод

Closes the buffer
public close ( )

flush() публичный Метод

Flushes the buffer to the storage media
public flush ( ) : boolean
Результат boolean

getBuffer() публичный Метод

Returns the complete contents of the buffer
public getBuffer ( ) : string
Результат string

getLength() публичный Метод

Returns the current length
public getLength ( ) : integer
Результат integer

getPosition() публичный Метод

Returns the current pointer position
public getPosition ( ) : integer
Результат integer

getStat() публичный Метод

Returns the stat information for the buffer
public getStat ( ) : array
Результат array

isEof() публичный Метод

Returns true if the pointer is at the end of the buffer
public isEof ( ) : boolean
Результат boolean

read() публичный Метод

Reads $count bytes from the buffer
public read ( integer $count ) : string | null
$count integer The number of bytes to read
Результат string | null

setPosition() публичный Метод

Sets the pointer position
public setPosition ( integer $position, integer $whence ) : boolean
$position integer The position in bytes
$whence integer The reference from where to measure $position (SEEK_SET, SEEK_CUR or SEEK_END)
Результат boolean True if the position could be set

write() публичный Метод

Writes the given date into the buffer at the current pointer position
public write ( string $data ) : integer
$data string The data to write
Результат integer The number of bytes written

Описание свойств

$buffer защищенное свойство

The buffer contents
protected string $buffer
Результат string

$length защищенное свойство

The buffer length
protected int $length
Результат integer

$mode защищенное свойство

The read/write mode
protected string $mode
Результат string

$objectInfo защищенное свойство

The object info if available
protected array $objectInfo
Результат array

$position защищенное свойство

The current pointer position
protected int $position
Результат integer