PHP Class lithium\net\socket\Stream

This stream adapter provides the required method implementations of the abstract Socket class for the open(), close(), read(), write(), timeout() eof() and encoding() methods.
See also: lithium\net\socket\Stream
Inheritance: extends lithium\net\Socket
Afficher le fichier Open project: unionofrad/lithium Class Usage Examples

Méthodes publiques

Méthode Description
close ( ) : boolean Closes the stream
encoding ( string $charset ) : boolean Sets the character set for stream encoding if possible. The stream_encoding function is not guaranteed to be available as it is seems as if it's experimental or just not officially documented. If the function is not available returns false.
eof ( ) : boolean Determines if the socket resource is at EOF.
open ( array $options = [] ) : mixed Opens a socket and initializes the internal resource handle.
read ( integer $length = null, integer $offset = null ) : string Reads data from the stream resource
timeout ( integer $time ) : boolean Set timeout period on a stream.
write ( string $data = null ) : mixed writes data to the stream resource

Method Details

close() public méthode

Closes the stream
public close ( ) : boolean
Résultat boolean True on closed connection

encoding() public méthode

Sets the character set for stream encoding if possible. The stream_encoding function is not guaranteed to be available as it is seems as if it's experimental or just not officially documented. If the function is not available returns false.
public encoding ( string $charset ) : boolean
$charset string
Résultat boolean Returns `false` if `stream_encoding()` function does not exist, boolean result of `stream_encoding()` otherwise.

eof() public méthode

Determines if the socket resource is at EOF.
public eof ( ) : boolean
Résultat boolean Returns `true` if resource pointer is at its EOF, `false` otherwise.

open() public méthode

Opens a socket and initializes the internal resource handle.
public open ( array $options = [] ) : mixed
$options array update the config settings
Résultat mixed Returns `false` if the socket configuration does not contain the `'scheme'` or `'host'` settings, or if configuration fails, otherwise returns a resource stream. Throws exception if there is a network error.

read() public méthode

Reads data from the stream resource
public read ( integer $length = null, integer $offset = null ) : string
$length integer If specified, will read up to $length bytes from the stream. If no value is specified, all remaining bytes in the buffer will be read.
$offset integer Seek to the specified byte offset before reading.
Résultat string Returns string read from stream resource on success, false otherwise.

timeout() public méthode

Set timeout period on a stream.
public timeout ( integer $time ) : boolean
$time integer The timeout value in seconds.
Résultat boolean

write() public méthode

writes data to the stream resource
public write ( string $data = null ) : mixed
$data string The string to be written.
Résultat mixed False on error, number of bytes written otherwise.