SeekerInterface
in
Defines an interface for retrieving arbitrary data from within an object.
Catching exceptions is the responsibility of the implementation, and in such cases, a NULL should be returned.
Tags
Table of Contents
- getStream() : resource
- Retrieve a file pointer that returns a decompressed copy of `$length` bytes starting from `$offset`.
- retrieveEnd() : string
- Retrieve data from the end of the object, with an optional offset.
- retrieveStart() : string
- Retrieve data from the start of the object, with an optional offset.
Methods
getStream()
Retrieve a file pointer that returns a decompressed copy of `$length` bytes starting from `$offset`.
public
getStream(int $length[, int $offset = 0 ][, int $compression = 0 ]) : resource
Parameters
- $length : int
-
The number of bytes to be read.
- $offset : int = 0
-
The offset from the start of the object.
- $compression : int = 0
-
The value of the compression header for the file.
Tags
Return values
resource —A file pointer to retrieve the decompressed bytes.
retrieveEnd()
Retrieve data from the end of the object, with an optional offset.
public
retrieveEnd(int $length[, int $offset = 0 ]) : string
If no offset is supplied, then the last $length
bytes should be returned (or up to $length if the object is smaller).
If an offset is supplied, then $length
bytes should be returned, starting at $offset
bytes from the end of the object (or the start of the object if the object is smaller).
Parameters
- $length : int
-
The number of bytes to be returned.
- $offset : int = 0
-
The offset counting backwards from the end of the object.
Tags
Return values
string —The bytestring of the data.
retrieveStart()
Retrieve data from the start of the object, with an optional offset.
public
retrieveStart(int $length[, int $offset = 0 ]) : string
If no offset is supplied, then the first $length
bytes should be returned (or up to $length if the object is smaller).
If an offset is supplied, then the first $offset
bytes should be discarded, and then $length
bytes returned.
Parameters
- $length : int
-
The number of bytes to be returned.
- $offset : int = 0
-
The offset from the start of the object.
Tags
Return values
string —The bytestring of the data.