InflateStream
extends FilteredStream
in package
Stream inflate (RFC 1951).
Tags
Table of Contents
Constants
- BUFFER_SIZE = 8192
Properties
- $buffer : string
- Internal buffer.
- $readFilter : resource
- $readFilterCallback : callable
- $stream : StreamInterface
- $writeFilter : resource
- $writeFilterCallback : callable
Methods
- __construct() : mixed
- __toString() : string
- Reads all data from the stream into a string, from the beginning to end.
- close() : void
- detach() : mixed
- eof() : bool
- Returns true if the stream is at the end of the stream.
- getContents() : string
- Returns the remaining contents in a string
- getMetadata() : mixed
- getReadFilter() : string
- Returns the read filter name.
- getSize() : int|null
- Always returns null because we can't tell the size of a stream when we filter.
- getWriteFilter() : string
- Returns the write filter name.
- isReadable() : bool
- isSeekable() : bool
- Filtered streams are not seekable.
- isWritable() : bool
- read() : string
- Read data from the stream.
- rewind() : void
- Filtered streams are not seekable and can thus not be rewound.
- seek() : void
- Filtered streams are not seekable.
- tell() : int
- write() : int
- fill() : void
- Buffer is filled by reading underlying stream.
- readFilter() : string
- Returns the write filter name.
- writeFilter() : string
- Returns the write filter name.
Constants
BUFFER_SIZE
public
mixed
BUFFER_SIZE
= 8192
Properties
$buffer
Internal buffer.
protected
string
$buffer
= ''
$readFilter
since version 1.5, will be removed in 2.0
protected
resource
$readFilter
$readFilterCallback
protected
callable
$readFilterCallback
$stream
protected
StreamInterface
$stream
$writeFilter
since version 1.5, will be removed in 2.0
protected
resource
$writeFilter
$writeFilterCallback
since version 1.5, will be removed in 2.0
protected
callable
$writeFilterCallback
Methods
__construct()
public
__construct(StreamInterface $stream[, int $level = -1 ]) : mixed
Parameters
- $stream : StreamInterface
- $level : int = -1
__toString()
Reads all data from the stream into a string, from the beginning to end.
public
__toString() : string
This method MUST attempt to seek to the beginning of the stream before reading data and read the stream until the end is reached.
Warning: This could attempt to load a large amount of data into memory.
This method MUST NOT raise an exception in order to conform with PHP's string casting operations.
Return values
stringclose()
public
close() : void
detach()
public
detach() : mixed
eof()
Returns true if the stream is at the end of the stream.
public
eof() : bool
Return values
boolgetContents()
Returns the remaining contents in a string
public
getContents() : string
Return values
stringgetMetadata()
public
getMetadata([string|null $key = null ]) : mixed
Parameters
- $key : string|null = null
getReadFilter()
Returns the read filter name.
public
getReadFilter() : string
since version 1.5, will be removed in 2.0
Return values
stringgetSize()
Always returns null because we can't tell the size of a stream when we filter.
public
getSize() : int|null
Return values
int|null —Returns the size in bytes if known, or null if unknown.
getWriteFilter()
Returns the write filter name.
public
getWriteFilter() : string
since version 1.5, will be removed in 2.0
Return values
stringisReadable()
public
isReadable() : bool
Return values
boolisSeekable()
Filtered streams are not seekable.
public
isSeekable() : bool
We would need to buffer and process everything to allow seeking.
Return values
boolisWritable()
public
isWritable() : bool
Return values
boolread()
Read data from the stream.
public
read(int $length) : string
Parameters
- $length : int
-
Read up to $length bytes from the object and return them. Fewer than $length bytes may be returned if underlying stream call returns fewer bytes.
Return values
string —Returns the data read from the stream, or an empty string if no bytes are available.
rewind()
Filtered streams are not seekable and can thus not be rewound.
public
rewind() : void
seek()
Filtered streams are not seekable.
public
seek(int $offset[, int $whence = SEEK_SET ]) : void
Parameters
- $offset : int
-
Stream offset
- $whence : int = SEEK_SET
-
Specifies how the cursor position will be calculated based on the seek offset. Valid values are identical to the built-in PHP $whence values for
fseek(). SEEK_SET: Set position equal to offset bytes SEEK_CUR: Set position to current location plus offset SEEK_END: Set position to end-of-stream plus offset.
tell()
public
tell() : int
Return values
intwrite()
public
write(string $string) : int
Parameters
- $string : string
Return values
intfill()
Buffer is filled by reading underlying stream.
protected
fill() : void
Callback is reading once more even if the stream is ended. This allow to get last data in the PHP buffer otherwise this bug is present : https://bugs.php.net/bug.php?id=48725
readFilter()
Returns the write filter name.
protected
readFilter() : string
Return values
stringwriteFilter()
Returns the write filter name.
protected
writeFilter() : string