*/
const SEPARATOR_ENTRIES = 0x04;
+ /**
+ * Separator type->position
+ */
+ const SEPARATOR_TYPE_POSITION = 0x05;
+
/**
* Length of count
*/
*/
const LENGTH_NAME = 10;
+ /**
+ * Maximum length of entry type
+ */
+ const LENGTH_TYPE = 20;
+
/**
* The real class name
*/
*/
public static function isBlockSeparatorFound ($str) {
// Determine it
- $isFound = (strpos($str, self::getBlockSeparator()) !== FALSE);
+ $isFound = (strpos($str, chr(self::SEPARATOR_ENTRIES)) !== FALSE);
// Return result
return $isFound;
}
-
- /**
- * Getter for block separator character(s)
- *
- * @return $blockSeparator A separator for blocks
- */
- protected static final function getBlockSeparator () {
- return chr(self::SEPARATOR_ENTRIES);
- }
}
// [EOF]
$this->initBackBuffer();
// Separate data
- $dataArray = explode(self::getBlockSeparator(), $data);
+ $dataArray = explode(chr(self::SEPARATOR_ENTRIES), $data);
// This array must contain two elements
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('dataArray=' . print_r($dataArray, TRUE));
// Calculate header size
$this->setHeaderSize(
strlen(self::INDEX_MAGIC) +
- strlen(self::SEPARATOR_HEADER_DATA) +
+ strlen(chr(self::SEPARATOR_HEADER_DATA)) +
self::LENGTH_COUNT +
- strlen(self::SEPARATOR_HEADER_ENTRIES)
+ strlen(chr(self::SEPARATOR_HEADER_ENTRIES))
);
// Init counters and gaps array
*/
public function calculateMinimumBlockLength () {
// Calulcate it
- // @TODO Not finished yet
- $length = 0;
+ $length = self::LENGTH_TYPE + strlen(chr(self::SEPARATOR_TYPE_POSITION)) + self::LENGTH_POSITION + strlen(chr(self::SEPARATOR_ENTRIES));
// Return it
return $length;
// Calculate header size
$this->setHeaderSize(
strlen(self::STACK_MAGIC) +
- strlen(self::SEPARATOR_HEADER_DATA) +
+ strlen(chr(self::SEPARATOR_HEADER_DATA)) +
self::LENGTH_COUNT +
- strlen(self::SEPARATOR_HEADER_DATA) +
+ strlen(chr(self::SEPARATOR_HEADER_DATA)) +
self::LENGTH_POSITION +
- strlen(self::SEPARATOR_HEADER_ENTRIES)
+ strlen(chr(self::SEPARATOR_HEADER_ENTRIES))
);
// Init counters and gaps array
*/
public function calculateMinimumBlockLength () {
// Calulcate it
- $length = self::getHashLength() + strlen(chr(self::SEPARATOR_HASH_NAME)) + self::LENGTH_NAME + 1 + strlen(self::getBlockSeparator());
+ $length = self::getHashLength() + strlen(chr(self::SEPARATOR_HASH_NAME)) + self::LENGTH_NAME + 1 + strlen(chr(self::SEPARATOR_ENTRIES));
// Return it
return $length;