use StackableTrait;
use IndexableTrait;
- /**
- * Separator for header data
- */
- const SEPARATOR_HEADER_DATA = 0x01;
-
- /**
- * Separator header->entries
- */
- const SEPARATOR_HEADER_ENTRIES = 0x02;
-
- /**
- * Separator group->hash
- */
- const SEPARATOR_GROUP_HASH = 0x03;
-
- /**
- * Separator hash->value
- */
- const SEPARATOR_HASH_VALUE = 0x04;
-
- /**
- * Separator entry->entry
- */
- const SEPARATOR_ENTRIES = 0x05;
-
- /**
- * Separator type->position
- */
- const SEPARATOR_TYPE_POSITION = 0x06;
-
- /**
- * Length of count
- */
- const LENGTH_COUNT = 20;
-
- /**
- * Length of position
- */
- const LENGTH_POSITION = 20;
-
- /**
- * Length of group
- */
- const LENGTH_GROUP = 10;
-
- /**
- * Maximum length of entry type
- */
- const LENGTH_TYPE = 20;
-
- //***** Array elements for 'gaps' array *****
-
- /**
- * Start of gap
- */
- const GAPS_INDEX_START = 'start';
-
- /**
- * End of gap
- */
- const GAPS_INDEX_END = 'end';
-
/**
* Current seek position
*/
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-BINARY-FILE: this->gaps()=%d', count($this->gaps)));
foreach ($this->gaps as $gap) {
// Calculate size of found gap: end-start including both
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-BINARY-FILE: gap[%s]=%d,ga[%s]=%d', self::GAPS_INDEX_START, $gap[self::GAPS_INDEX_START], self::GAPS_INDEX_END, $gap[self::GAPS_INDEX_END]));
- $gapsSize += ($gap[self::GAPS_INDEX_END] - $gap[self::GAPS_INDEX_START]);
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-BINARY-FILE: gap[%s]=%d,ga[%s]=%d', BinaryFile::GAPS_INDEX_START, $gap[BinaryFile::GAPS_INDEX_START], BinaryFile::GAPS_INDEX_END, $gap[BinaryFile::GAPS_INDEX_END]));
+ $gapsSize += ($gap[BinaryFile::GAPS_INDEX_END] - $gap[BinaryFile::GAPS_INDEX_START]);
// Debug message
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-BINARY-FILE: gapsSize=%d', $gapsSize));
// Push to gaps array
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-BINARY-FILE: startPosition=%d,endPosition=%d - CALLED!', $startPosition, $endPosition));
array_push($this->gaps, [
- self::GAPS_INDEX_START => $startPosition,
- self::GAPS_INDEX_END => $endPosition,
+ BinaryFile::GAPS_INDEX_START => $startPosition,
+ BinaryFile::GAPS_INDEX_END => $endPosition,
]);
// Trace message
}
// Determine it
- $isFound = (strpos($str, chr(self::SEPARATOR_ENTRIES)) !== false);
+ $isFound = (strpos($str, chr(BinaryFile::SEPARATOR_ENTRIES)) !== false);
// Return result
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-BINARY-FILE: isFound=%d - EXIT!', intval($isFound)));
}
// Separate data
- $dataArray = explode(chr(self::SEPARATOR_ENTRIES), $data);
+ $dataArray = explode(chr(BinaryFile::SEPARATOR_ENTRIES), $data);
// Left part is the actual block, right one the back-buffer data, if found
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-BINARY-FILE: dataArray()=%d', count($dataArray)));