PHP Class Protobuf\Stream

Author: Fabio B. Silva ([email protected])
Afficher le fichier Open project: protobuf-php/protobuf Class Usage Examples

Méthodes publiques

Méthode Description
__construct ( resource $stream, integer $size = null )
__destruct ( ) Closes the stream when the destructed
__toString ( )
create ( ) : Stream Create a new stream.
eof ( ) : boolean Returns true if the stream is at the end of the stream.
fromString ( string $resource = '', integer $size = null ) : Stream Create a new stream from a string.
getContents ( ) : string Returns the remaining contents of the stream as a string.
getSize ( ) : integer | null Get the size of the stream
read ( integer $length ) : string Read data from the stream
readStream ( integer $length ) : Stream Read stream
seek ( integer $offset, integer $whence = SEEK_SET ) Seek to a position in the stream
tell ( ) : integer Returns the current position of the file read/write pointer
wrap ( Stream | resource | string $resource = '', integer $size = null ) : Stream Wrap the input resource in a stream object.
write ( string $bytes, integer $length ) : integer Write data to the stream
writeStream ( Stream $stream, integer $length ) : integer Write stream

Method Details

__construct() public méthode

public __construct ( resource $stream, integer $size = null )
$stream resource
$size integer

__destruct() public méthode

Closes the stream when the destructed
public __destruct ( )

__toString() public méthode

public __toString ( )

create() public static méthode

Create a new stream.
public static create ( ) : Stream
Résultat Stream

eof() public méthode

Returns true if the stream is at the end of the stream.
public eof ( ) : boolean
Résultat boolean

fromString() public static méthode

Create a new stream from a string.
public static fromString ( string $resource = '', integer $size = null ) : Stream
$resource string
$size integer
Résultat Stream

getContents() public méthode

Returns the remaining contents of the stream as a string.
public getContents ( ) : string
Résultat string

getSize() public méthode

Get the size of the stream
public getSize ( ) : integer | null
Résultat integer | null Returns the size in bytes if known

read() public méthode

Read data from the stream
public read ( integer $length ) : string
$length integer
Résultat string

readStream() public méthode

Read stream
public readStream ( integer $length ) : Stream
$length integer
Résultat Stream

seek() public méthode

Seek to a position in the stream
public seek ( integer $offset, integer $whence = SEEK_SET )
$offset integer
$whence integer

tell() public méthode

Returns the current position of the file read/write pointer
public tell ( ) : integer
Résultat integer

wrap() public static méthode

Wrap the input resource in a stream object.
public static wrap ( Stream | resource | string $resource = '', integer $size = null ) : Stream
$resource Stream | resource | string
$size integer
Résultat Stream

write() public méthode

Write data to the stream
public write ( string $bytes, integer $length ) : integer
$bytes string
$length integer
Résultat integer

writeStream() public méthode

Write stream
public writeStream ( Stream $stream, integer $length ) : integer
$stream Stream
$length integer
Résultat integer