5 * @author Roland Haeder <webmaster@ship-simu.org>
7 * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Core Developer Team
8 * @license GNU GPL 3.0 or any newer version
9 * @link http://www.ship-simu.org
11 * This program is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation, either version 3 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program. If not, see <http://www.gnu.org/licenses/>.
24 class BaseFile extends BaseFrameworkSystem {
26 * Separator for header data
28 const SEPARATOR_HEADER_DATA = 0x01;
31 * Separator header->entries
33 const SEPARATOR_HEADER_ENTRIES = 0x02;
36 * Separator hash->name
38 const SEPARATOR_HASH_NAME = 0x03;
41 * Separator entry->entry
43 const SEPARATOR_ENTRIES = 0x04;
46 * Separator type->position
48 const SEPARATOR_TYPE_POSITION = 0x05;
53 const LENGTH_COUNT = 20;
58 const LENGTH_POSITION = 20;
63 const LENGTH_NAME = 10;
66 * Maximum length of entry type
68 const LENGTH_TYPE = 20;
70 //***** Array elements for 'gaps' array *****
75 const GAPS_INDEX_START = 'start';
80 const GAPS_INDEX_END = 'end';
83 * Counter for total entries
85 private $totalEntries = 0;
88 * Current seek position
90 private $seekPosition = 0;
95 private $headerSize = 0;
100 private $header = array();
103 * Seek positions for gaps ("fragmentation")
105 private $gaps = array();
108 * Seek positions for damaged entries (e.g. mismatching hash sum, ...)
110 private $damagedEntries = array();
113 * The current file we are working in
115 private $fileName = '';
120 private $backBuffer = '';
123 * Currently loaded block (will be returned by current())
125 private $currentBlock = '';
128 * Protected constructor
130 * @param $className Name of the class
133 protected function __construct ($className) {
134 // Call parent constructor
135 parent::__construct($className);
137 // Init counters and gaps array
138 $this->initCountersGapsArray();
142 * Destructor for cleaning purposes, etc
146 public final function __destruct() {
147 // Try to close a file
150 // Call the parent destructor
151 parent::__destruct();
155 * Checks whether the abstracted file only contains gaps by counting all
156 * gaps' bytes together and compare it to total length.
158 * @return $isGapsOnly Whether the abstracted file only contains gaps
160 private function isFileOnlyGaps () {
161 // First/last gap found?
162 /* Only for debugging
163 if (isset($this->gaps[0])) {
164 // Output first and last gap
165 self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] this->gaps[0]=%s,this->gaps[%s]=%s', __METHOD__, __LINE__, print_r($this->gaps[0], TRUE), (count($this->gaps) - 1), print_r($this->gaps[count($this->gaps) - 1], TRUE)));
169 // Now count every gap
171 foreach ($this->gaps as $gap) {
172 // Calculate size of found gap: end-start including both
173 $gapsSize += ($gap[self::GAPS_INDEX_END] - $gap[self::GAPS_INDEX_START]);
177 //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] gapsSize=%s,this->headerSize=%s', __METHOD__, __LINE__, $gapsSize, $this->getHeaderSize()));
179 // Total gap size + header size must be same as file size
180 $isGapsOnly = (($this->getHeaderSize() + $gapsSize) == $this->getFileSize());
187 * Initializes counter for valid entries, arrays for damaged entries and
188 * an array for gap seek positions. If you call this method on your own,
189 * please re-analyze the file structure. So you are better to call
190 * analyzeFile() instead of this method.
194 public function initCountersGapsArray () {
195 // Init counter and seek position
196 $this->setCounter(0);
197 $this->setSeekPosition(0);
200 $this->gaps = array();
201 $this->damagedEntries = array();
205 * "Getter" for abstracted file size
207 * @return $fileSize Size of abstracted file
209 public function getFileSize () {
210 // Call block instanze
211 return $this->getBlockInstance()->getFileSize();
215 * Getter for total entries
217 * @return $totalEntries Total entries in this file
219 public final function getCounter () {
221 return $this->totalEntries;
225 * Setter for total entries
227 * @param $totalEntries Total entries in this file
230 protected final function setCounter ($counter) {
232 $this->totalEntries = $counter;
240 protected final function incrementCounter () {
242 $this->totalEntries++;
246 * Getter for header size
248 * @return $totalEntries Size of file header
250 public final function getHeaderSize () {
252 return $this->headerSize;
256 * Setter for header size
258 * @param $headerSize Size of file header
261 public final function setHeaderSize ($headerSize) {
263 $this->headerSize = $headerSize;
267 * Getter for header array
269 * @return $totalEntries Size of file header
271 public final function getHeader () {
273 return $this->header;
279 * @param $header Array for a file header
282 public final function setHeader (array $header) {
284 $this->header = $header;
288 * Getter for seek position
290 * @return $seekPosition Current seek position (stored here in object)
292 protected final function getSeekPosition () {
294 return $this->seekPosition;
298 * Setter for seek position
300 * @param $seekPosition Current seek position (stored here in object)
303 protected final function setSeekPosition ($seekPosition) {
305 $this->seekPosition = $seekPosition;
309 * Updates seekPosition attribute from file to avoid to much access on file.
313 public function updateSeekPosition () {
314 //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] CALLED!', __METHOD__, __LINE__));
316 // Get key (= seek position)
317 $seekPosition = $this->key();
318 //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] Setting seekPosition=%s', __METHOD__, __LINE__, $seekPosition));
321 $this->setSeekPosition($seekPosition);
323 //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] EXIT!', __METHOD__, __LINE__));
327 * Seeks to beginning of file, updates seek position in this object and
328 * flushes the header.
332 protected function rewindUpdateSeekPosition () {
333 //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] CALLED!', __METHOD__, __LINE__));
335 // flushFileHeader must be callable
336 assert(is_callable(array($this, 'flushFileHeader')));
338 // Seek to beginning of file
341 // And update seek position ...
342 $this->updateSeekPosition();
344 // ... to write it back into the file
345 $this->flushFileHeader();
347 //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] EXIT!!', __METHOD__, __LINE__));
351 * Seeks to old position
355 protected function seekToOldPosition () {
356 //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] CALLED!', __METHOD__, __LINE__));
358 // Seek to currently ("old") saved position
359 $this->seek($this->getSeekPosition());
361 //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] EXIT!!', __METHOD__, __LINE__));
365 * Checks whether the block separator has been found
367 * @param $str String to look in
368 * @return $isFound Whether the block separator has been found
370 public static function isBlockSeparatorFound ($str) {
372 $isFound = (strpos($str, chr(self::SEPARATOR_ENTRIES)) !== FALSE);
379 * Getter for the file pointer
381 * @return $filePointer The file pointer which shall be a valid file resource
382 * @throws UnsupportedOperationException If this method is called
384 public final function getPointer () {
385 throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
389 * Setter for file name
391 * @param $fileName The new file name
394 protected final function setFileName ($fileName) {
395 $fileName = (string) $fileName;
396 $this->fileName = $fileName;
400 * Getter for file name
402 * @return $fileName The current file name
404 public final function getFileName () {
405 return $this->fileName;
409 * Initializes the back-buffer by setting it to an empty string.
413 private function initBackBuffer () {
414 // Simply call the setter
415 $this->setBackBuffer('');
419 * Setter for backBuffer field
421 * @param $backBuffer Characters to "store" in back-buffer
424 private function setBackBuffer ($backBuffer) {
425 // Cast to string (so no arrays or objects)
426 $backBuffer = (string) $backBuffer;
429 $this->backBuffer = $backBuffer;
433 * Getter for backBuffer field
435 * @return $backBuffer Characters "stored" in back-buffer
437 private function getBackBuffer () {
438 return $this->backBuffer;
442 * Setter for currentBlock field
444 * @param $currentBlock Characters to set a currently loaded block
447 private function setCurrentBlock ($currentBlock) {
448 // Cast to string (so no arrays or objects)
449 $currentBlock = (string) $currentBlock;
452 $this->currentBlock = $currentBlock;
456 * Gets currently read data
458 * @return $current Currently read data
460 public function getCurrentBlock () {
462 return $this->currentBlock;
466 * Initializes this file class
468 * @param $fileName Name of this abstract file
471 protected function initFile ($fileName) {
472 // Get a file i/o pointer instance
473 $pointerInstance = ObjectFactory::createObjectByConfiguredName('file_raw_input_output_class', array($fileName));
475 // ... and set it here
476 $this->setPointerInstance($pointerInstance);
480 * Writes data at given position
482 * @param $seekPosition Seek position
483 * @param $data Data to be written
484 * @param $flushHeader Whether to flush the header (default: flush)
487 protected function writeData ($seekPosition, $data, $flushHeader = TRUE) {
488 //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] seekPosition=%s,data()=%s - CALLED!', __METHOD__, __LINE__, $seekPosition, strlen($data)));
490 // Write data at given position
491 $this->getPointerInstance()->writeAtPosition($seekPosition, $data);
493 // Update seek position
494 $this->updateSeekPosition();
497 if ($flushHeader === TRUE) {
499 $this->flushFileHeader();
501 // Seek to old position
502 $this->seekToOldPosition();
505 //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] EXIT!', __METHOD__, __LINE__));
509 * Marks the currently loaded block as empty (with length of the block)
511 * @param $length Length of the block
514 protected function markCurrentBlockAsEmpty ($length) {
515 // Get current seek position
516 $currentPosition = $this->key();
518 // Now add it as gap entry
519 array_push($this->gaps, array(
520 self::GAPS_INDEX_START => ($currentPosition - $length),
521 self::GAPS_INDEX_END => $currentPosition,
526 * Checks whether the file header is initialized
528 * @return $isInitialized Whether the file header is initialized
530 public function isFileHeaderInitialized () {
531 //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] CALLED!', __METHOD__, __LINE__));
533 // Default is not initialized
534 $isInitialized = FALSE;
536 // Is the file initialized?
537 if ($this->isFileInitialized()) {
538 // Some bytes has been written, so rewind to start of it.
539 $rewindStatus = $this->rewind();
540 //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] rewindStatus=%s', __METHOD__, __LINE__, $rewindStatus));
542 // Is the rewind() call successfull?
543 if ($rewindStatus != 1) {
544 // Something bad happened
545 self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] Could not rewind().', __METHOD__, __LINE__));
549 $this->readFileHeader();
551 // The above method does already check the header
552 $isInitialized = TRUE;
556 //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] isInitialized=%d - EXIT!', __METHOD__, __LINE__, intval($isInitialized)));
557 return $isInitialized;
561 * Checks whether the assigned file has been initialized
563 * @return $isInitialized Whether the file's size is zero
565 public function isFileInitialized () {
566 //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] CALLED!', __METHOD__, __LINE__));
568 // Get it from iterator which holds the pointer instance. If FALSE is returned
569 $fileSize = $this->size();
570 //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] fileSize=%s', __METHOD__, __LINE__, $fileSize));
573 * The returned file size should not be FALSE or NULL as this means
574 * that the pointer class does not work correctly.
576 assert(is_int($fileSize));
578 // Is more than 0 returned?
579 $isInitialized = ($fileSize > 0);
582 //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] isInitialized=%d - EXIT!', __METHOD__, __LINE__, intval($isInitialized)));
583 return $isInitialized;
587 * Creates the assigned file
591 public function createFileHeader () {
592 //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] CALLED!', __METHOD__, __LINE__));
594 // The file's header should not be initialized here
595 assert(!$this->isFileHeaderInitialized());
597 // Simple flush file header which will create it.
598 $this->flushFileHeader();
600 // Rewind seek position (to beginning of file) and update/flush file header
601 $this->rewindUpdateSeekPosition();
603 //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] EXIT!!', __METHOD__, __LINE__));
607 * Pre-allocates file (if enabled) with some space for later faster write access.
609 * @param $type Type of the file
612 public function preAllocateFile ($type) {
613 //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] CALLED!', __METHOD__, __LINE__));
616 if ($this->getConfigInstance()->getConfigEntry($type . '_pre_allocate_enabled') != 'Y') {
618 self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] Not pre-allocating file.', __METHOD__, __LINE__));
620 // Don't continue here.
625 self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] Pre-allocating file ...', __METHOD__, __LINE__));
627 // Calculate minimum length for one entry
628 $minLengthEntry = $this->getBlockInstance()->calculateMinimumBlockLength();
629 //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] minLengthEntry=%s', __METHOD__, __LINE__, $minLengthEntry));
631 // Calulcate seek position
632 $seekPosition = $minLengthEntry * $this->getConfigInstance()->getConfigEntry($type . '_pre_allocate_count');
633 //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] seekPosition=%s', __METHOD__, __LINE__, $seekPosition));
635 // Now simply write a NUL there. This will pre-allocate the file.
636 $this->writeData($seekPosition, chr(0));
638 // Rewind seek position (to beginning of file) and update/flush file header
639 $this->rewindUpdateSeekPosition();
641 //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] EXIT!', __METHOD__, __LINE__));
645 * Close a file source and set it's instance to null and the file name
651 public function closeFile () {
652 $this->partialStub('Unfinished method.');
655 $this->setFileName('');
659 * Determines seek position
661 * @return $seekPosition Current seek position
663 public function determineSeekPosition () {
664 // Call pointer instance
665 return $this->getPointerInstance()->determineSeekPosition();
669 * Seek to given offset (default) or other possibilities as fseek() gives.
671 * @param $offset Offset to seek to (or used as "base" for other seeks)
672 * @param $whence Added to offset (default: only use offset to seek to)
673 * @return $status Status of file seek: 0 = success, -1 = failed
675 public function seek ($offset, $whence = SEEK_SET) {
676 // Call pointer instance
677 return $this->getPointerInstance()->seek($offset, $whence);
683 * @return $size Size (in bytes) of file
684 * @todo Handle seekStatus
686 public function size () {
687 // Call pointer instance
688 return $this->getPointerInstance()->size();
692 * Read data a file pointer
694 * @return mixed The result of fread()
695 * @throws NullPointerException If the file pointer instance
696 * is not set by setPointer()
697 * @throws InvalidResourceException If there is being set
699 public function readFromFile () {
700 // Call pointer instance
701 return $this->getPointerInstance()->readFromFile();
705 * Reads given amount of bytes from file.
707 * @param $bytes Amount of bytes to read
708 * @return $data Data read from file
710 public function read ($bytes) {
711 // Call pointer instance
712 return $this->getPointerInstance()->read($bytes);
716 * Write data to a file pointer
718 * @param $dataStream The data stream we shall write to the file
719 * @return mixed Number of writes bytes or FALSE on error
720 * @throws NullPointerException If the file pointer instance
721 * is not set by setPointer()
722 * @throws InvalidResourceException If there is being set
723 * an invalid file resource
725 public function writeToFile ($dataStream) {
726 // Call pointer instance
727 return $this->getPointerInstance()->writeToFile($dataStream);
731 * Rewinds to the beginning of the file
733 * @return $status Status of this operation
735 public function rewind () {
736 // Call pointer instance
737 return $this->getPointerInstance()->rewind();
741 * Determines whether the EOF has been reached
743 * @return $isEndOfFileReached Whether the EOF has been reached
745 public final function isEndOfFileReached () {
746 // Call pointer instance
747 return $this->getPointerInstance()->isEndOfFileReached();
751 * Analyzes entries in index file. This will count all found (and valid)
752 * entries, mark invalid as damaged and count gaps ("fragmentation"). If
753 * only gaps are found, the file is considered as "virgin" (no entries).
757 public function analyzeFile () {
758 //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] CALLED!', __METHOD__, __LINE__));
760 // Make sure the file is initialized
761 assert($this->isFileInitialized());
763 // Init counters and gaps array
764 $this->initCountersGapsArray();
766 // Output message (as this may take some time)
767 self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] Analyzing file structure ... (this may take some time)', __METHOD__, __LINE__));
769 // First rewind to the begining
772 // Then try to load all entries
773 while ($this->valid()) {
778 $current = $this->getCurrentBlock();
781 * If the block is empty, maybe the whole file is? This could mean
782 * that the file has been pre-allocated.
784 if (empty($current)) {
785 // Then skip this part
790 /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] current()=%s', __METHOD__, __LINE__, strlen($current)));
793 // If the last read block is empty, check gaps
794 if (empty($current)) {
796 self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] Found a total of %s gaps.', __METHOD__, __LINE__, count($this->gaps)));
798 // Check gaps, if the whole file is empty.
799 if ($this->isFileOnlyGaps()) {
800 // Only gaps, so don't continue here.
805 * The above call has calculated a total size of all gaps. If the
806 * percentage of gaps passes a "soft" limit and last
807 * defragmentation is to far in the past, or if a "hard" limit has
808 * reached, run defragmentation.
810 if ($this->isDefragmentationNeeded()) {
811 // Run "defragmentation"
812 $this->doRunDefragmentation();
815 //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] EXIT!', __METHOD__, __LINE__));
819 * Advances to next "block" of bytes
823 public function next () {
824 // Is there nothing to read?
825 if (!$this->valid()) {
831 //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d] key()=%s', __FUNCTION__, __LINE__, $this->key()));
833 // Make sure the block instance is set
834 assert($this->getBlockInstance() instanceof CalculatableBlock);
836 // First calculate minimum block length
837 $length = $this->getBlockInstance()->calculateMinimumBlockLength();
838 //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d] length=%s', __FUNCTION__, __LINE__, $length));
840 // Short be more than zero!
843 // Read possibly back-buffered bytes from previous call of next().
844 $data = $this->getBackBuffer();
847 * Read until a entry/block separator has been found. The next read
848 * "block" may not fit, so this loop will continue until the EOB or EOF
849 * has been reached whatever comes first.
851 while ((!$this->isEndOfFileReached()) && (!self::isBlockSeparatorFound($data))) {
852 // Then read the next possible block
853 $block = $this->read($length);
856 //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d] block()=%s,length=%s', __FUNCTION__, __LINE__, strlen($block), $length));
859 if (strlen(trim($block)) == 0) {
860 // Mark this block as empty
861 $this->markCurrentBlockAsEmpty(strlen($block));
863 // Skip to next block
867 // At this block then
871 //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d] data()=%s', __FUNCTION__, __LINE__, strlen($data)));
875 if ($this->isEndOfFileReached()) {
876 // Set whole data as current read block
877 //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('Calling setCurrentBlock(' . strlen($data) . ') ...');
878 $this->setCurrentBlock($data);
880 // Then abort here silently
881 //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('EOF reached.');
886 * Init back-buffer which is the data that has been found beyond the
889 $this->initBackBuffer();
892 $dataArray = explode(chr(self::SEPARATOR_ENTRIES), $data);
894 // This array must contain two elements
895 //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('dataArray=' . print_r($dataArray, TRUE));
896 assert(count($dataArray) == 2);
898 // Left part is the actual block, right one the back-buffer data
899 $this->setCurrentBlock($dataArray[0]);
900 $this->setBackBuffer($dataArray[1]);
904 * Checks wether the current entry is valid (not at the end of the file).
905 * This method will return TRUE if an emptied (nulled) entry has been found.
907 * @return $isValid Whether the next entry is valid
909 public function valid () {
910 // Make sure the block instance is set
911 assert($this->getBlockInstance() instanceof Block);
913 // First calculate minimum block length
914 $length = $this->getBlockInstance()->calculateMinimumBlockLength();
916 // Short be more than zero!
919 // Get current seek position
920 $seekPosition = $this->key();
922 // Then try to read it
923 $data = $this->read($length);
925 // If some bytes could be read, all is fine
926 $isValid = ((is_string($data)) && (strlen($data) > 0));
929 $headerSize = $this->getHeaderSize();
931 // Is the seek position at or beyond the header?
932 if ($seekPosition >= $headerSize) {
933 // Seek back to old position
934 $this->seek($seekPosition);
936 // Seek directly behind the header
937 $this->seek($headerSize);
945 * Gets current seek position ("key").
947 * @return $key Current key in iteration
949 public function key () {
950 // Call pointer instance
951 return $this->getPointerInstance()->determineSeekPosition();
955 * Reads the file header
959 public function readFileHeader () {
960 // Make sure the block instance is set
961 assert($this->getBlockInstance() instanceof Block);
963 // Call block instance
964 $this->getBlockInstance()->readFileHeader();
968 * Flushes the file header
972 public function flushFileHeader () {
973 // Make sure the block instance is set
974 assert($this->getBlockInstance() instanceof Block);
976 // Call block instance
977 $this->getBlockInstance()->flushFileHeader();