// Import framework stuff
use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
-use Org\Mxchange\CoreFramework\Configuration\FrameworkConfiguration;
// Import SPL stuff
use \InvalidArgumentException;
* This class loads class include files with a specific prefix and suffix
*
* @author Roland Haeder <webmaster@shipsimu.org>
- * @version 1.5.0
+ * @version 1.6.0
* @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2021 Core Developer Team
* @license GNU GPL 3.0 or any newer version
* @link http://www.shipsimu.org
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* ----------------------------------
- * 1.5
+ * 1.6.0
+ * - This class loader is now 100% singleton, no other instance is really
+ * required, therefore the factory method can be removed safely
+ * - renamed initLoader() to initClassLoader()
+ * - An instance of a FrameworkConfiguration is no longer set here as this
+ * violated the rule that there shall be no instance set of that class
+ * - .htaccess is marked as deprecated as this should be no longer done
+ * - scanClassPath() is now protected, please use other scan*() methods
+ * 1.5.0
* - Namespace scheme Project\Package[\SubPackage...] is fully supported and
* throws an InvalidArgumentException if not present. The last part will be
* always the class' name.
- * 1.4
+ * 1.4.0
* - Some comments improved, other minor improvements
- * 1.3
+ * 1.3.0
* - Constructor is now empty and factory method 'createClassLoader' is created
* - renamed loadClasses to scanClassPath
* - Added initLoader()
- * 1.2
+ * 1.2.0
* - ClassLoader rewritten to PHP SPL's own RecursiveIteratorIterator class
- * 1.1
+ * 1.1.0
* - loadClasses rewritten to fix some notices
- * 1.0
+ * 1.0.0
* - Initial release
* ----------------------------------
*/
}
}
- /**
- * Creates an instance of this class loader for given configuration instance
- *
- * @param $configInstance Configuration class instance
- * @return void
- */
- public static final function createClassLoader (FrameworkConfiguration $configInstance) {
- // Get a new instance
- $loaderInstance = new ClassLoader();
-
- // Init the instance
- $loaderInstance->initLoader($configInstance);
-
- // Return the prepared instance
- return $loaderInstance;
- }
-
/**
* Scans for all framework classes, exceptions and interfaces.
*
//* NOISY-DEBUG: */ printf('[%s:%d]: CALLED!' . PHP_EOL, __METHOD__, __LINE__);
$loaderInstance = self::getSelfInstance();
- // Get config instance
+ // "Cache" configuration instance
$configInstance = FrameworkBootstrap::getConfigurationInstance();
// Load all classes
//* NOISY-DEBUG: */ printf('[%s:%d]: CALLED!' . PHP_EOL, __METHOD__, __LINE__);
$loaderInstance = self::getSelfInstance();
- // Get config instance
+ // "Cache" configuration instance
$configInstance = FrameworkBootstrap::getConfigurationInstance();
// Load all classes for the application
// Trace message
//* NOISY-DEBUG: */ printf('[%s:%d]: CALLED!' . PHP_EOL, __METHOD__, __LINE__);
- // Get config instance
+ // "Cache" configuration instance
$configInstance = FrameworkBootstrap::getConfigurationInstance();
// Load all classes for the application
*
* @param $className Name of the class to load
* @return void
+ * @throws InvalidArgumentException If the class' name does not contain a namespace: Tld\Domain\Project is AT LEAST recommended!
*/
public static function autoLoad (string $className) {
- // Trace message
- //* NOISY-DEBUG: */ printf('[%s:%d]: className=%s - CALLED!' . PHP_EOL, __METHOD__, __LINE__, $className);
+ // The class name should contain at least 2 back-slashes, so split at them
+ //* NOISY-DEBUG: */ printf('[%s:%d] className=%s - CALLED!' . PHP_EOL, __METHOD__, __LINE__, $className);
+ $classNameParts = explode("\\", $className);
+
+ // At least 3 parts should be there
+ if ((self::$strictNamingConvention === true) && (count($classNameParts) < 5)) {
+ // Namespace scheme is: Project\Package[\SubPackage...]
+ throw new InvalidArgumentException(sprintf('Class name "%s" is not conform to naming-convention: Tld\Domain\Project\Package[\SubPackage...]\SomeFooBar', $className));
+ }
// Try to include this class
self::getSelfInstance()->loadClassFile($className);
public static final function getSelfInstance () {
// Is the instance there?
if (is_null(self::$selfInstance)) {
- // Get a new one
- self::$selfInstance = ClassLoader::createClassLoader(FrameworkBootstrap::getConfigurationInstance());
+ // Get a new one and initialize it
+ self::$selfInstance = new ClassLoader();
+ self::$selfInstance->initClassLoader();
}
// Return the instance
return self::$selfInstance;
}
+ /**
+ * Getter for total include counter
+ *
+ * @return $total Total loaded include files
+ */
+ public final function getTotal () {
+ return $this->total;
+ }
+
+ /**
+ * Getter for a printable list of included main/interfaces/exceptions
+ *
+ * @param $includeList A printable include list
+ */
+ public function getPrintableIncludeList () {
+ // Prepare the list
+ $includeList = '';
+ foreach ($this->loadedClasses as $classFile) {
+ $includeList .= basename($classFile) . '<br />' . PHP_EOL;
+ }
+
+ // And return it
+ return $includeList;
+ }
+
/**
* Scans recursively a local path for class files which must have a prefix and a suffix as given by $this->suffix and $this->prefix
*
* @param $ignoreList An optional list (array forced) of directory and file names which shall be ignored
* @return void
*/
- public function scanClassPath (string $basePath, array $ignoreList = [] ) {
+ protected function scanClassPath (string $basePath, array $ignoreList = [] ) {
// Is a list has been restored from cache, don't read it again
if ($this->listCached === true) {
// Abort here
/*
* Ignore .htaccess by default as it is for protection of directories
* on Apache servers.
+ *
+ * @deprecated
*/
array_push($ignoreList, '.htaccess');
}
}
- /**
- * Getter for total include counter
- *
- * @return $total Total loaded include files
- */
- public final function getTotal () {
- return $this->total;
- }
-
- /**
- * Getter for a printable list of included main/interfaces/exceptions
- *
- * @param $includeList A printable include list
- */
- public function getPrintableIncludeList () {
- // Prepare the list
- $includeList = '';
- foreach ($this->loadedClasses as $classFile) {
- $includeList .= basename($classFile) . '<br />' . PHP_EOL;
- }
-
- // And return it
- return $includeList;
- }
-
/**
* Initializes our loader class
*
- * @param $configInstance Configuration class instance
* @return void
*/
- private function initLoader (FrameworkConfiguration $configInstance) {
- // Set configuration instance
- $this->configInstance = $configInstance;
-
+ private function initClassLoader () {
// Construct the FQFN for the cache
if (!FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('developer_mode_enabled')) {
// Init cache instances
- $this->listCacheFile = new SplFileInfo($this->configInstance->getConfigEntry('local_database_path') . 'list-' . FrameworkBootstrap::getDetectedApplicationName() . '.cache');
- $this->classCacheFile = new SplFileInfo($this->configInstance->getConfigEntry('local_database_path') . 'class-' . FrameworkBootstrap::getDetectedApplicationName() . '.cache');
+ $this->listCacheFile = new SplFileInfo(FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('local_database_path') . 'list-' . FrameworkBootstrap::getDetectedApplicationName() . '.cache');
+ $this->classCacheFile = new SplFileInfo(FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('local_database_path') . 'class-' . FrameworkBootstrap::getDetectedApplicationName() . '.cache');
}
// Set suffix and prefix from configuration
- $this->suffix = $configInstance->getConfigEntry('class_suffix');
- $this->prefix = $configInstance->getConfigEntry('class_prefix');
+ $this->suffix = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('class_suffix');
+ $this->prefix = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('class_prefix');
// Set own instance
self::$selfInstance = $this;
*
* @param $className The class that shall be loaded
* @return void
- * @throws InvalidArgumentException If strict-checking is enabled and class name is not following naming-convention
*/
private function loadClassFile (string $className) {
// The class name should contain at least 2 back-slashes, so split at them
//* NOISY-DEBUG: */ printf('[%s:%d] className=%s - CALLED!' . PHP_EOL, __METHOD__, __LINE__, $className);
$classNameParts = explode("\\", $className);
- // At least 3 parts should be there
- if ((self::$strictNamingConvention === true) && (count($classNameParts) < 5)) {
- // Namespace scheme is: Project\Package[\SubPackage...]
- throw new InvalidArgumentException(sprintf('Class name "%s" is not conform to naming-convention: Tld\Domain\Project\Package[\SubPackage...]\SomeFooBar', $className));
- }
-
// Get last element
$shortClassName = array_pop($classNameParts);
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)));
use Org\Mxchange\CoreFramework\EntryPoint\ApplicationEntryPoint;
use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory;
use Org\Mxchange\CoreFramework\Filesystem\File\BaseBinaryFile;
+use Org\Mxchange\CoreFramework\Filesystem\File\BinaryFile;
use Org\Mxchange\CoreFramework\Index\BaseIndex;
use Org\Mxchange\CoreFramework\Index\Indexable;
use Org\Mxchange\CoreFramework\Utils\String\StringUtils;
// Empty file header
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FILE-INDEX: File header is empty - EXIT!');
return;
- } elseif (substr($data, -1, 1) != chr(BaseBinaryFile::SEPARATOR_HEADER_ENTRIES)) {
+ } elseif (substr($data, -1, 1) != chr(BinaryFile::SEPARATOR_HEADER_ENTRIES)) {
// Bad last character
throw new UnexpectedValueException(sprintf('data=%s does not end with "%s"',
$data,
- chr(BaseBinaryFile::SEPARATOR_HEADER_ENTRIES)
+ chr(BinaryFile::SEPARATOR_HEADER_ENTRIES)
));
}
* 0 => magic
* 1 => total entries
*/
- $header = explode(chr(BaseBinaryFile::SEPARATOR_HEADER_DATA), $data);
+ $header = explode(chr(BinaryFile::SEPARATOR_HEADER_DATA), $data);
// Check if the array has only 3 elements
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-INDEX: header()=%d', count($header)));
} elseif ($header[0] !== Indexable::INDEX_MAGIC) {
// Magic must be in first element
throw new UnexpectedValueException(sprintf('header[0]=%s is not the expected magic (%s)', $header[0], Indexable::INDEX_MAGIC));
- } elseif (strlen($header[1]) != BaseBinaryFile::LENGTH_COUNT) {
+ } elseif (strlen($header[1]) != BinaryFile::LENGTH_COUNT) {
// Length of total entries not matching
- throw new UnexpectedValueException(sprintf('header[1](%d)=%s does not have expected length %d', strlen($header[1]), $header[1], BaseBinaryFile::LENGTH_COUNT));
+ throw new UnexpectedValueException(sprintf('header[1](%d)=%s does not have expected length %d', strlen($header[1]), $header[1], BinaryFile::LENGTH_COUNT));
}
// Decode count
Indexable::INDEX_MAGIC,
// Separator header data
- chr(BaseBinaryFile::SEPARATOR_HEADER_DATA),
+ chr(BinaryFile::SEPARATOR_HEADER_DATA),
// Total entries
- str_pad(StringUtils::dec2hex($this->getIteratorInstance()->getBinaryFileInstance()->getCounter()), BaseBinaryFile::LENGTH_COUNT, '0', STR_PAD_LEFT),
+ str_pad(StringUtils::dec2hex($this->getIteratorInstance()->getBinaryFileInstance()->getCounter()), BinaryFile::LENGTH_COUNT, '0', STR_PAD_LEFT),
// Separator header<->entries
- chr(BaseBinaryFile::SEPARATOR_HEADER_ENTRIES)
+ chr(BinaryFile::SEPARATOR_HEADER_ENTRIES)
);
// Write it to disk (header is always at seek position 0)
// Calculate header size
$headerSize = (
strlen(Indexable::INDEX_MAGIC) +
- strlen(chr(BaseBinaryFile::SEPARATOR_HEADER_DATA)) +
- BaseBinaryFile::LENGTH_COUNT +
- strlen(chr(BaseBinaryFile::SEPARATOR_HEADER_ENTRIES))
+ strlen(chr(BinaryFile::SEPARATOR_HEADER_DATA)) +
+ BinaryFile::LENGTH_COUNT +
+ strlen(chr(BinaryFile::SEPARATOR_HEADER_ENTRIES))
);
// Set it
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FILE-INDEX: Calculating ...');
self::$minimumBlockLength = (
// Type
- BaseBinaryFile::LENGTH_TYPE + strlen(chr(BaseBinaryFile::SEPARATOR_TYPE_POSITION)) +
+ BinaryFile::LENGTH_TYPE + strlen(chr(BinaryFile::SEPARATOR_TYPE_POSITION)) +
// Position
- BaseBinaryFile::LENGTH_POSITION + strlen(chr(BaseBinaryFile::SEPARATOR_ENTRIES))
+ BinaryFile::LENGTH_POSITION + strlen(chr(BinaryFile::SEPARATOR_ENTRIES))
);
}
use Org\Mxchange\CoreFramework\Factory\Stack\File\FileStackIndexFactory;
use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory;
use Org\Mxchange\CoreFramework\Filesystem\File\BaseBinaryFile;
+use Org\Mxchange\CoreFramework\Filesystem\File\BinaryFile;
use Org\Mxchange\CoreFramework\Generic\UnsupportedOperationException;
use Org\Mxchange\CoreFramework\Stack\BaseStacker;
use Org\Mxchange\CoreFramework\Traits\Index\IndexableTrait;
// Last character must be the separator
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: data(-1)=%s', dechex(ord(substr($data, -1, 1)))));
- if (substr($data, -1, 1) !== chr(BaseBinaryFile::SEPARATOR_HEADER_ENTRIES)) {
+ if (substr($data, -1, 1) !== chr(BinaryFile::SEPARATOR_HEADER_ENTRIES)) {
// Not valid separator
throw new UnexpectedValueException(sprintf('data=%s does not have separator=%s at the end.',
$data,
- BaseBinaryFile::SEPARATOR_HEADER_ENTRIES
+ BinaryFile::SEPARATOR_HEADER_ENTRIES
));
}
* 1 => total entries
* 2 => current seek position
*/
- $header = explode(chr(BaseBinaryFile::SEPARATOR_HEADER_DATA), $data);
+ $header = explode(chr(BinaryFile::SEPARATOR_HEADER_DATA), $data);
// Check if the array has only 3 elements
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: header(%d)=%s', count($header), print_r($header, true)));
}
// Check length of count and seek position
- if (strlen($header[1]) != BaseBinaryFile::LENGTH_COUNT) {
+ if (strlen($header[1]) != BinaryFile::LENGTH_COUNT) {
// Count length not valid
throw new UnexpectedValueException(sprintf('header[1](%d)=%s is not expected %d length',
strlen($header[1]),
$header[1],
- BaseBinaryFile::LENGTH_COUNT
+ BinaryFile::LENGTH_COUNT
));
- } elseif (strlen($header[1]) != BaseBinaryFile::LENGTH_POSITION) {
+ } elseif (strlen($header[1]) != BinaryFile::LENGTH_POSITION) {
// Position length not valid
throw new UnexpectedValueException(sprintf('header[2](%d)=%s is not expected %d length',
strlen($header[1]),
$header[1],
- BaseBinaryFile::LENGTH_POSITION
+ BinaryFile::LENGTH_POSITION
));
}
StackableFile::STACK_MAGIC,
// Separator magic<->count
- chr(BaseBinaryFile::SEPARATOR_HEADER_DATA),
+ chr(BinaryFile::SEPARATOR_HEADER_DATA),
// Padded total entries
- str_pad(StringUtils::dec2hex($this->getIteratorInstance()->getBinaryFileInstance()->getCounter()), BaseBinaryFile::LENGTH_COUNT, '0', STR_PAD_LEFT),
+ str_pad(StringUtils::dec2hex($this->getIteratorInstance()->getBinaryFileInstance()->getCounter()), BinaryFile::LENGTH_COUNT, '0', STR_PAD_LEFT),
// Separator count<->seek position
- chr(BaseBinaryFile::SEPARATOR_HEADER_DATA),
+ chr(BinaryFile::SEPARATOR_HEADER_DATA),
// Padded seek position
- str_pad(StringUtils::dec2hex($this->getIteratorInstance()->getBinaryFileInstance()->getSeekPosition(), 2), BaseBinaryFile::LENGTH_POSITION, '0', STR_PAD_LEFT),
+ str_pad(StringUtils::dec2hex($this->getIteratorInstance()->getBinaryFileInstance()->getSeekPosition(), 2), BinaryFile::LENGTH_POSITION, '0', STR_PAD_LEFT),
// Separator position<->entries
- chr(BaseBinaryFile::SEPARATOR_HEADER_ENTRIES)
+ chr(BinaryFile::SEPARATOR_HEADER_ENTRIES)
);
// Write it to disk (header is always at seek position 0)
// Calculate header size
$headerSize = (
strlen(StackableFile::STACK_MAGIC) +
- strlen(chr(BaseBinaryFile::SEPARATOR_HEADER_DATA)) +
- BaseBinaryFile::LENGTH_COUNT +
- strlen(chr(BaseBinaryFile::SEPARATOR_HEADER_DATA)) +
- BaseBinaryFile::LENGTH_POSITION +
- strlen(chr(BaseBinaryFile::SEPARATOR_HEADER_ENTRIES))
+ strlen(chr(BinaryFile::SEPARATOR_HEADER_DATA)) +
+ BinaryFile::LENGTH_COUNT +
+ strlen(chr(BinaryFile::SEPARATOR_HEADER_DATA)) +
+ BinaryFile::LENGTH_POSITION +
+ strlen(chr(BinaryFile::SEPARATOR_HEADER_ENTRIES))
);
// Setting it
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FILE-STACK: Calculating ...');
self::$minimumBlockLength =
// Length of entry group
- BaseBinaryFile::LENGTH_GROUP + strlen(chr(BaseBinaryFile::SEPARATOR_GROUP_HASH)) +
+ BinaryFile::LENGTH_GROUP + strlen(chr(BinaryFile::SEPARATOR_GROUP_HASH)) +
// Hash + value
- self::getHashLength() + strlen(chr(BaseBinaryFile::SEPARATOR_HASH_VALUE)) + 1 +
+ self::getHashLength() + strlen(chr(BinaryFile::SEPARATOR_HASH_VALUE)) + 1 +
// Final separator
- strlen(chr(BaseBinaryFile::SEPARATOR_ENTRIES));
+ strlen(chr(BinaryFile::SEPARATOR_ENTRIES));
}
// Return it
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: stackName=%s,hash=%s,encoded()=%d - CALLED!', $stackName, $hash, strlen($encoded)));
$rawData = sprintf('%s%s%s%s%s',
$stackName,
- BaseBinaryFile::SEPARATOR_GROUP_HASH,
+ BinaryFile::SEPARATOR_GROUP_HASH,
hex2bin($hash),
- BaseBinaryFile::SEPARATOR_HASH_VALUE,
+ BinaryFile::SEPARATOR_HASH_VALUE,
$encoded
);
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
interface BinaryFile extends Filesystem {
+ /**
+ * 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';
+
/**
* Reads the file header
*