setasign\Fpdi\PdfParser
StreamReader A stream reader class
File: /FPDI v2/PdfParser/StreamReader.php
Class hierarchy
Summary
Properties
$buffer
The buffer.
$bufferLength
The buffer length.
$closeStream
Defines whether the stream should be closed when the stream reader instance is deconstructed or not.
$offset
The byte-offset position in the buffer.
$position
The byte-offset position in the stream.
$stream
The stream resource.
$totalLength
The total length of the stream.
Static Methods
createByString()
int $maxMemory = 2097152
Creates a stream reader instance by a string value.
Parameters
- $content : string
- $maxMemory : int
Methods
__construct()
StreamReader constructor.
Parameters
- $stream : resource
- $closeStream : bool
Defines whether to close the stream resource if the instance is destructed or not.
ensure()
Ensures bytes in the buffer with a specific length and location in the file.
Parameters
- $pos : int
- $length : int
See
ensureContent()
Make sure that there is at least one character beyond the current offset in the buffer.
getByte()
Gets a byte at a specific position in the buffer.
If the position is invalid the method will return false.
If the $position parameter is set to null the value of $this->offset will be used.
Parameters
- $position : ?int
increaseLength()
Forcefully read more data into the buffer.
Parameters
- $minLength : int
Return Values
Returns false if the stream reaches the end
readByte()
Returns a byte at a specific position, and set the offset to the next byte position.
If the position is invalid the method will return false.
If the $position parameter is set to null the value of $this->offset will be used.
Parameters
- $position : ?int
readBytes()
Read bytes from the current or a specific offset position and set the internal pointer to the next byte.
If the position is invalid the method will return false.
If the $position parameter is set to null the value of $this->offset will be used.
Parameters
- $length : int
- $position : ?int
reset()
Resets the buffer to a position and re-read the buffer with the given length.
If the $pos parameter is negative the start buffer position will be the $pos'th position from the end of the file.
If the $pos parameter is negative and the absolute value is bigger then the totalLength of the file $pos will set to zero.
Parameters
- $pos : ?int
Start position of the new buffer
- $length : int
Length of the new buffer. Mustn't be negative