PHP Class TQ\Vcs\Buffer\StreamBuffer

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

Protected Properties

Property Type Description
$stream resource The file resource

Public Methods

Method Description
__construct ( string $path, string $mode = 'r+' ) Creates a new file buffer with the given path
__destruct ( ) Destructor closes file stream handle
close ( ) Closes the buffer
flush ( ) : boolean Flushes the buffer to the storage media
getBuffer ( ) : string Returns the complete contents of the buffer
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 method

Creates a new file buffer with the given path
public __construct ( string $path, string $mode = 'r+' )
$path string The path
$mode string The file mode

__destruct() public method

Destructor closes file stream handle
public __destruct ( )

close() public method

Closes the buffer
public close ( )

flush() public method

Flushes the buffer to the storage media
public flush ( ) : boolean
return boolean

getBuffer() public method

Returns the complete contents of the buffer
public getBuffer ( ) : string
return string

getPosition() public method

Returns the current pointer position
public getPosition ( ) : integer
return integer

getStat() public method

Returns the stat information for the buffer
public getStat ( ) : array
return array

isEof() public method

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

read() public method

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

setPosition() public method

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

write() public method

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

Property Details

$stream protected_oe property

The file resource
protected resource $stream
return resource