PHP Class TQ\Vcs\Buffer\StringBuffer

Inheritance: implements TQ\Vcs\Buffer\FileBufferInterface
Afficher le fichier Open project: teqneers/php-stream-wrapper-for-git Class Usage Examples

Protected Properties

Свойство Type Description
$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

Méthodes publiques

Méthode Description
__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

Method Details

__construct() public méthode

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() public méthode

Closes the buffer
public close ( )

flush() public méthode

Flushes the buffer to the storage media
public flush ( ) : boolean
Résultat boolean

getBuffer() public méthode

Returns the complete contents of the buffer
public getBuffer ( ) : string
Résultat string

getLength() public méthode

Returns the current length
public getLength ( ) : integer
Résultat integer

getPosition() public méthode

Returns the current pointer position
public getPosition ( ) : integer
Résultat integer

getStat() public méthode

Returns the stat information for the buffer
public getStat ( ) : array
Résultat array

isEof() public méthode

Returns true if the pointer is at the end of the buffer
public isEof ( ) : boolean
Résultat boolean

read() public méthode

Reads $count bytes from the buffer
public read ( integer $count ) : string | null
$count integer The number of bytes to read
Résultat string | null

setPosition() public méthode

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)
Résultat boolean True if the position could be set

write() public méthode

Writes the given date into the buffer at the current pointer position
public write ( string $data ) : integer
$data string The data to write
Résultat integer The number of bytes written

Property Details

$buffer protected_oe property

The buffer contents
protected string $buffer
Résultat string

$length protected_oe property

The buffer length
protected int $length
Résultat integer

$mode protected_oe property

The read/write mode
protected string $mode
Résultat string

$objectInfo protected_oe property

The object info if available
protected array $objectInfo
Résultat array

$position protected_oe property

The current pointer position
protected int $position
Résultat integer