Interface StreamInterface
OO interface to PHP streams
Direct known implementers
Indirect known implementers
Guzzle\Http\AbstractEntityBodyDecorator
,
Guzzle\Http\CachingEntityBody
,
Guzzle\Http\EntityBody
,
Guzzle\Http\IoEmittingEntityBody
,
Guzzle\Http\ReadLimitEntityBody
Methods summary
-
public
__toString ( )
Convert the stream to a string if the stream is readable and the stream is seekable.
-
public
close ( )
Close the underlying stream
-
public
getMetaData ( string $key = null )
Get stream metadata
-
public
getStream ( )
Get the stream resource
-
public
setStream ( resource $stream, int $size = null )
Set the stream that is wrapped by the object
-
public
detachStream ( )
Detach the current stream resource
-
public
getWrapper ( )
Get the stream wrapper type
-
public
getWrapperData ( )
Wrapper specific data attached to this stream.
-
public
getStreamType ( )
Get a label describing the underlying implementation of the stream
-
public
getUri ( )
Get the URI/filename associated with this stream
-
public
getSize ( )
Get the size of the stream if able
-
public
isReadable ( )
Check if the stream is readable
-
public
isRepeatable ( )
Check if the stream is repeatable
-
public
isWritable ( )
Check if the stream is writable
-
public
isConsumed ( )
Check if the stream has been consumed
-
public
feof ( )
Alias of isConsumed
-
public
isLocal ( )
Check if the stream is a local stream vs a remote stream
-
public
isSeekable ( )
Check if the string is repeatable
-
public
setSize ( int $size )
Specify the size of the stream in bytes
-
public
seek ( int $offset, int $whence = SEEK_SET )
Seek to a position in the stream
-
public
read ( int $length )
Read data from the stream
-
public
write ( string $string )
Write data to the stream
-
public
ftell ( )
Returns the current position of the file read/write pointer
-
public
rewind ( )
Rewind to the beginning of the stream
-
public
readLine ( int $maxLength = null )
Read a line from the stream up to the maximum allowed buffer length
-
public
setCustomData ( string $key, mixed $value )
Set custom data on the stream
-
public
getCustomData ( string $key )
Get custom data from the stream
Methods detail
Convert the stream to a string if the stream is readable and the stream is seekable.
Returns
string
Close the underlying stream
Get stream metadata
Parameters
- $key
string
$key Specific metadata to retrieve
Returns
array|mixed|null
Get the stream resource
Returns
resource
Set the stream that is wrapped by the object
Parameters
- $stream
resource
$stream Stream resource to wrap- $size
integer
$size Size of the stream in bytes. Only pass if the size cannot be obtained from the stream.
Returns
Get the stream wrapper type
Returns
string
Wrapper specific data attached to this stream.
Returns
array
Get a label describing the underlying implementation of the stream
Returns
string
Get the URI/filename associated with this stream
Returns
string
Get the size of the stream if able
Returns
integer|boolean
Check if the stream is readable
Returns
boolean
Check if the stream is repeatable
Returns
boolean
Check if the stream is writable
Returns
boolean
Check if the stream has been consumed
Returns
boolean
Alias of isConsumed
Returns
boolean
Check if the stream is a local stream vs a remote stream
Returns
boolean
Check if the string is repeatable
Returns
boolean
Specify the size of the stream in bytes
Parameters
- $size
integer
$size Size of the stream contents in bytes
Returns
Seek to a position in the stream
Parameters
- $offset
integer
$offset Stream offset- $whence
integer
$whence Where the offset is applied
Returns
boolean
Returns TRUE on success or FALSE on failure
Link
Read data from the stream
Parameters
- $length
integer
$length Up to length number of bytes read.
Returns
string|boolean
Returns the data read from the stream or FALSE on failure or EOF
Write data to the stream
Parameters
- $string
string
$string The string that is to be written.
Returns
integer|boolean
Returns the number of bytes written to the stream on success or FALSE on failure.
Returns the current position of the file read/write pointer
Returns
integer|boolean
Returns the position of the file pointer or false on error
Rewind to the beginning of the stream
Returns
boolean
Returns true on success or false on failure
Read a line from the stream up to the maximum allowed buffer length
Parameters
- $maxLength
integer
$maxLength Maximum buffer length
Returns
string|boolean
Set custom data on the stream
Parameters
- $key
string
$key Key to set- $value
mixed
$value Value to set
Returns
Get custom data from the stream
Parameters
- $key
string
$key Key to retrieve
Returns
null|mixed