]> git.mxchange.org Git - core.git/blobdiff - inc/classes/main/file_directories/binary/class_BaseBinaryFile.php
Continued:
[core.git] / inc / classes / main / file_directories / binary / class_BaseBinaryFile.php
index a6cfad6ca64d76a55bf290cbfce159f450767b22..8debce70d844326f6505f56786097f6ae1bf3c09 100644 (file)
@@ -33,19 +33,24 @@ class BaseBinaryFile extends BaseAbstractFile {
        const SEPARATOR_HEADER_ENTRIES = 0x02;
 
        /**
-        * Separator hash->name
+        * Separator group->hash
         */
-       const SEPARATOR_HASH_NAME = 0x03;
+       const SEPARATOR_GROUP_HASH = 0x03;
+
+       /**
+        * Separator hash->value
+        */
+       const SEPARATOR_HASH_VALUE = 0x04;
 
        /**
         * Separator entry->entry
         */
-       const SEPARATOR_ENTRIES = 0x04;
+       const SEPARATOR_ENTRIES = 0x05;
 
        /**
         * Separator type->position
         */
-       const SEPARATOR_TYPE_POSITION = 0x05;
+       const SEPARATOR_TYPE_POSITION = 0x06;
 
        /**
         * Length of count
@@ -58,9 +63,9 @@ class BaseBinaryFile extends BaseAbstractFile {
        const LENGTH_POSITION = 20;
 
        /**
-        * Length of name
+        * Length of group
         */
-       const LENGTH_NAME = 10;
+       const LENGTH_GROUP = 10;
 
        /**
         * Maximum length of entry type
@@ -822,6 +827,24 @@ class BaseBinaryFile extends BaseAbstractFile {
                // Call block instance
                $this->getBlockInstance()->flushFileHeader();
        }
+
+       /**
+        * Searches for next suitable gap the given length of data can fit in
+        * including padding bytes.
+        *
+        * @param       $length                 Length of raw data
+        * @return      $seekPosition   Found next gap's seek position
+        */
+       public function searchNextGap ($length) {
+               // If the file is only gaps, no need to seek
+               if ($this->isFileOnlyGaps()) {
+                       // The first empty block is the first one right after the header
+                       return ($this->getHeaderSize() + 1);
+               } // END - if
+
+               // @TODO Unfinished
+               $this->partialStub('length=' . $length);
+       }
 }
 
 // [EOF]