*
* @return void
*/
- private function readFileHeader () {
+ protected function readFileHeader () {
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] CALLED!', __METHOD__, __LINE__));
// First rewind to beginning as the header sits at the beginning ...
* 1 => total entries
* 2 => current seek position
*/
- $this->header = explode(chr(self::SEPARATOR_HEADER_DATA), $data);
+ $header = explode(chr(self::SEPARATOR_HEADER_DATA), $data);
+
+ // Set header here
+ $this->setHeader($header);
// Check if the array has only 3 elements
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] header(%d)=%s', __METHOD__, __LINE__, count($this->header), print_r($this->header, TRUE)));
- assert(count($this->header) == 3);
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] header(%d)=%s', __METHOD__, __LINE__, count($header), print_r($header, TRUE)));
+ assert(count($header) == 3);
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] Passed assert().', __METHOD__, __LINE__));
// Check magic
- assert($this->header[0] == self::STACK_MAGIC);
+ assert($header[0] == self::STACK_MAGIC);
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] Passed assert().', __METHOD__, __LINE__));
// Check length of count and seek position
- assert(strlen($this->header[1]) == self::LENGTH_COUNT);
+ assert(strlen($header[1]) == self::LENGTH_COUNT);
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] Passed assert().', __METHOD__, __LINE__));
- assert(strlen($this->header[2]) == self::LENGTH_POSITION);
+ assert(strlen($header[2]) == self::LENGTH_POSITION);
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] Passed assert().', __METHOD__, __LINE__));
// Decode count and seek position
- $this->header[1] = hex2bin($this->header[1]);
- $this->header[2] = hex2bin($this->header[2]);
+ $header[1] = hex2bin($header[1]);
+ $header[2] = hex2bin($header[2]);
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] EXIT!', __METHOD__, __LINE__));
}
*
* @return void
*/
- private function flushFileHeader () {
+ protected function flushFileHeader () {
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] CALLED!', __METHOD__, __LINE__));
// Put all informations together
$this->setIndexInstance($indexInstance);
}
+ /**
+ * Calculates minimum length for one entry
+ *
+ * @return $length Minimum length for one entry
+ */
+ protected function caluclateMinimumFileEntryLength () {
+ // Calulcate it
+ $length = self::getHashLength() + strlen(self::SEPARATOR_HASH_NAME) + self::LENGTH_NAME + 1;
+
+ // Return it
+ return $length;
+ }
+
/**
* Adds a value to given stack
*