Stream Class
Aurora\Http Namespace
Interfaces
- I StreamInterface
- I Stringable
Properties
stream
Stream resource
protected $stream: resource
seekable
Seekable flag
protected $seekable = : bool
readable
Readable flag
protected $readable = : bool
writable
Writeable flag
protected $writable = : bool
uri
Stream URI
protected $uri: mixed
size
Stream size
protected $size = 0: int
readWriteHash
Hash of readable and writable stream types
protected static $readWriteHash = []: array
Constructor
__construct
Constructor
Parameters
mixed
$contents
— Stream contents
Signature
public function __construct(mixed $contents = '')
Methods
__construct
Constructor
Parameters
-
mixed
$contents
— Stream contents
Return Value
\StreamInterface
Signature
public function __construct(mixed $contents = '')
__destruct
Destructor
Signature
public function __destruct()
__toString
Reads all data from the stream into a string, from the beginning to end
Return Value
string
Signature
public function __toString()
close
Closes the stream and any underlying resources
Signature
public function close()
detach
Separates any underlying resources from the stream
Return Value
mixed
Signature
public function detach()
getSize
Get the size of the stream if known
Return Value
mixed
Signature
public function getSize()
tell
Returns the current position of the file read/write pointer
Return Value
int
Signature
public function tell()
eof
Returns true if the stream is at the end of the stream
Return Value
bool
Signature
public function eof()
isSeekable
Returns whether or not the stream is seekable
Return Value
bool
Signature
public function isSeekable()
seek
Seek to a position in the stream
Parameters
-
mixed
$offset
— Stream offset -
mixed
$whence
— Specifies how the cursor position will be calculated based on the seek offset
Signature
public function seek(mixed $offset, mixed $whence)
rewind
Seek to the beginning of the stream
Signature
public function rewind()
isWritable
Returns whether or not the stream is writable
Return Value
bool
Signature
public function isWritable()
write
Write data to the stream
Parameters
-
mixed
$string
— The string that is to be written
Return Value
int
Signature
public function write(mixed $string)
isReadable
Returns whether or not the stream is readable
Return Value
bool
Signature
public function isReadable()
read
Read data from the stream
Parameters
-
mixed
$length
— Read up to $length bytes from the object and return them
Return Value
string
Signature
public function read(mixed $length)
getContents
Returns the remaining contents in a string
Return Value
string
Signature
public function getContents()
getMetadata
Get stream metadata as an associative array or retrieve a specific key
Parameters
-
mixed
$key
— Specific metadata to retrieve
Return Value
mixed
Signature
public function getMetadata(mixed $key)