SetaPDF_Core_Reader_String Class for a string reader

File: /SetaPDF/Core/Reader/String.php

Class hierarchy

Implements

Summary

Properties

$_buffer

protected string SetaPDF_Core_Reader_String::$_buffer = ''

The current buffer

$_length

The length of the buffer

$_offset

The offset to the current position

$_pos

The current file position

$_string

protected string SetaPDF_Core_Reader_String::$_string = ''

The complete string.

$_totalLength

The total length


Methods

__construct()

public SetaPDF_Core_Reader_String::__construct ( string $string )

The constructor.

Parameters
$string : string
 

__toString()

public string SetaPDF_Core_Reader_String::__toString ( void )

Returns the complete string.

addOffset()

public void SetaPDF_Core_Reader_AbstractReader::addOffset ( integer $offset )

Add an offset to the current offset.

Parameters
$offset : integer
 

cleanUp()

public void SetaPDF_Core_Reader_String::cleanUp ( void )

Implementation of SetaPDF_Core_Reader_ReaderInterface (empty body for this type of reader).

See

copyTo()

public void SetaPDF_Core_Reader_String::copyTo ( SetaPDF_Core_WriteInterface $writer )

Copies the complete content to the writer.

Parameters
$writer : SetaPDF_Core_WriteInterface
 

ensureContent()

public boolean SetaPDF_Core_Reader_AbstractReader::ensureContent ( void )

Make sure that there is at least one character beyond the current offset in the buffer.

getBuffer()

public string SetaPDF_Core_Reader_AbstractReader::getBuffer ( [ boolean $atOffset = true ] )

Returns the current buffer.

Parameters
$atOffset : boolean
 

getByte()

public string|boolean SetaPDF_Core_Reader_AbstractReader::getByte ( [ integer $pos = null ] )

Gets a byte at a specific position.

If the position is invalid the method will return false.

If non position is set $this->_offset will used.

Parameters
$pos : integer
 

getLength()

public int SetaPDF_Core_Reader_AbstractReader::getLength ( [ boolean $atOffset = false ] )

Returns the byte length of the buffer.

Parameters
$atOffset : boolean
 

getOffset()

public integer SetaPDF_Core_Reader_AbstractReader::getOffset ( void )

Returns the current offset of the current position.

getPos()

public int SetaPDF_Core_Reader_AbstractReader::getPos ( void )

Get the current position of the pointer.

getString()

public string SetaPDF_Core_Reader_String::getString ( void )

Get the complete string.

getTotalLength()

public int SetaPDF_Core_Reader_String::getTotalLength ( void )

Gets the total available length.

increaseLength()

public boolean; SetaPDF_Core_Reader_String::increaseLength ( [ int $minLength = 50000 ] )

Forcefully read more data into the buffer.

Parameters
$minLength : int
 

readByte()

public string|boolean SetaPDF_Core_Reader_AbstractReader::readByte ( [ integer $pos = null ] )

Returns a byte at a specific position, returns it and set the offset to the next byte position.

If the position is invalid the method will return false.

If non position is set $this->_offset will used.

Parameters
$pos : integer
 

readBytes()

public string SetaPDF_Core_Reader_AbstractReader::readBytes ( integer $length [, integer $pos = null ] )

Get a specific byte count from the current or at a specific offset position and set the internal pointer to the next byte.

If the position is invalid the method will return false.

If non position is set $this->_offset will used.

Parameters
$length : integer
 
$pos : integer
 

readLine()

public string SetaPDF_Core_Reader_AbstractReader::readLine ( [ integer $length = 1024 ] )

Read a line from the current position.

Parameters
$length : integer
 

reset()

public void SetaPDF_Core_Reader_String::reset ( [ int|null $pos = 0 [, int $length = 100 ]] )

Resets the buffer to a specific position and reread the buffer with the given length.

The behavior of the arguments is the same like "substr" ($pos=$start; $length=$length).

Parameters
$pos : int|null

Start position of the new buffer.

$length : int

Length of the new buffer.

See

setOffset()

public void SetaPDF_Core_Reader_AbstractReader::setOffset ( int $offset )

Set the offset position.

Parameters
$offset : int
 
Exceptions

Throws SetaPDF_Core_Reader_Exception

setString()

public void SetaPDF_Core_Reader_String::setString ( string $string )

Set the string.

Parameters
$string : string