Stream¶
-
php\io\Stream
abstract class
Children
- class php\io\FileStream
- class php\io\MiscStream
- class php\io\ResourceStream
- class php\net\NetStream
Properties
Methods
getPath
()¶
Returns: string
getMode
()¶
Returns: string
read
($length)¶abstract
throws php\io\IOException
Parameters:
- $length – int - - count of bytes
Returns: mixed
readFully
()¶abstract
throws php\io\IOException
Returns: mixed
write
($value, $length = null)¶abstract
throws php\io\IOException
Parameters:
- $value – string
- $length – null, int
Returns: int
eof
()¶abstract
Returns: bool
seek
($position)¶abstract
throws php\io\IOException
Parameters:
- $position – int
Returns: mixed
getPosition
()¶abstract
throws php\io\IOException
Returns: int
close
()¶abstract
Returns: mixed
__construct
($path, $mode = null)¶
Parameters:
- $path – string
- $mode – null, string
Returns:
setContext
($context)¶
Parameters:
- $context –
Returns: void
getContext
()¶
Returns: mixed
- static
of
($path, $mode = 'r')¶throws php\io\IOException
Parameters:
- $path – string
- $mode – string
Returns:
- static
getContents
($path, $mode = 'r')¶Create a stream, call and return the result of the readFully() method, finally call the close() method.
throws php\io\IOException
Parameters:
- $path – string
- $mode – string
Returns: string binary
- static
putContents
($path, $data, $mode = 'w+')¶Create a stream, call and return the result of the write() method, finally call the close() method.
throws php\io\IOException
Parameters:
- $path – string
- $data – string
- $mode – string
- static
tryAccess
($path, $onAccess, $mode = 'r')¶Open a stream and close it after calling $onAccess automatically.
throws php\io\IOException
Parameters:
- $path – string
- $onAccess – callable - (Stream $stream)
- $mode – string
- static
exists
($path)¶Checks stream is exists. It tries to open a stream and if all is ok, returns true and closes it.
throws php\io\\Exception if you check external streams like http or ftp
Parameters:
- $path – string
Returns: bool
- static
register
($protocol, $className)¶
Parameters:
- $protocol – string
- $className – string
- static
unregister
($protocol)¶
Parameters:
- $protocol –