Stream

php\io\Stream

abstract class

Children


Properties


property path

string

private

property mode

string

private

Methods


getPath()
Returns:string
getMode()
Returns:string
read($length)

abstract

throws php\io\IOException

Parameters:
  • $lengthint - - count of bytes
Returns:

mixed

readFully()

abstract

throws php\io\IOException

Returns:mixed
write($value, $length = null)

abstract

throws php\io\IOException

Parameters:
  • $valuestring
  • $lengthnull, int
Returns:

int

eof()

abstract

Returns:bool
seek($position)

abstract

throws php\io\IOException

Parameters:
  • $positionint
Returns:

mixed

getPosition()

abstract

throws php\io\IOException

Returns:int
close()

abstract

Returns:mixed
__construct($path, $mode = null)
Parameters:
  • $pathstring
  • $modenull, string
Returns:

php\io\Stream

setContext($context)
Parameters:
  • $context
Returns:

void

getContext()
Returns:mixed
static of($path, $mode = 'r')

throws php\io\IOException

Parameters:
  • $pathstring
  • $modestring
Returns:

php\io\Stream

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:
  • $pathstring
  • $modestring
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:
  • $pathstring
  • $datastring
  • $modestring
static tryAccess($path, $onAccess, $mode = 'r')

Open a stream and close it after calling $onAccess automatically.

throws php\io\IOException

Parameters:
  • $pathstring
  • $onAccesscallable - (Stream $stream)
  • $modestring
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:
  • $pathstring
Returns:

bool

static register($protocol, $className)
Parameters:
  • $protocolstring
  • $classNamestring
static unregister($protocol)
Parameters:
  • $protocol