X-Git-Url: https://git.mxchange.org/?p=core.git;a=blobdiff_plain;f=inc%2Fclasses%2Fmain%2Ffile_directories%2Fclass_BaseFile.php;h=5fade9baeeaaded5a0f87f0af175e2fed130e20d;hp=3da2dc02ae57ca81a832c3bf79d2841085a7630e;hb=d4a9ba3bac64cc833de7b5af32bca2880b6cd542;hpb=8d8803b0e26be08bd5684c30e6e76778ca9371b4 diff --git a/inc/classes/main/file_directories/class_BaseFile.php b/inc/classes/main/file_directories/class_BaseFile.php index 3da2dc02..5fade9ba 100644 --- a/inc/classes/main/file_directories/class_BaseFile.php +++ b/inc/classes/main/file_directories/class_BaseFile.php @@ -208,7 +208,7 @@ y * @return void // Is the file initialized? if ($this->isFileInitialized()) { // Some bytes has been written, so rewind to start of it. - $rewindStatus = $this->getIteratorInstance()->rewind(); + $rewindStatus = $this->rewind(); //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] rewindStatus=%s', __METHOD__, __LINE__, $rewindStatus)); // Is the rewind() call successfull? @@ -218,7 +218,7 @@ y * @return void } // END - if // Read file header - $this->getBlockInstance()->readFileHeader(); + $this->readFileHeader(); // The above method does already check the header $isInitialized = TRUE; @@ -267,7 +267,7 @@ y * @return void assert(!$this->isFileHeaderInitialized()); // Simple flush file header which will create it. - $this->getBlockInstance()->flushFileHeader(); + $this->flushFileHeader(); // Rewind seek position (to beginning of file) and update/flush file header $this->rewineUpdateSeekPosition(); @@ -470,7 +470,7 @@ y * @return void } // END - if // Make sure the block instance is set - assert($this->getBlockInstance() instanceof CalculatableBlock); + assert($this->getBlockInstance() instanceof Block); // First calculate minimum block length $length = $this->getBlockInstance()->calculateMinimumBlockLength(); @@ -480,7 +480,7 @@ y * @return void // Wait until a entry/block separator has been found $data = $this->getBackBuffer(); - while ((!$this->isEndOfFileReached()) && (!$this->getBlockInstance()->isBlockSeparatorFound($data))) { + while ((!$this->isEndOfFileReached()) && (!self::isBlockSeparatorFound($data))) { // Then read the block $data .= $this->read($length); //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('data()=' . strlen($data)); @@ -523,7 +523,7 @@ y * @return void */ public function valid () { // Make sure the block instance is set - assert($this->getBlockInstance() instanceof CalculatableBlock); + assert($this->getBlockInstance() instanceof Block); // First calculate minimum block length $length = $this->getBlockInstance()->calculateMinimumBlockLength(); @@ -565,6 +565,32 @@ y * @return void // Call pointer instance return $this->getPointerInstance()->determineSeekPosition(); } + + /** + * Reads the file header + * + * @return void + */ + public function readFileHeader () { + // Make sure the block instance is set + assert($this->getBlockInstance() instanceof Block); + + // Call block instance + $this->getBlockInstance()->readFileHeader(); + } + + /** + * Flushes the file header + * + * @return void + */ + public function flushFileHeader () { + // Make sure the block instance is set + assert($this->getBlockInstance() instanceof Block); + + // Call block instance + $this->getBlockInstance()->flushFileHeader(); + } } // [EOF]