]> git.mxchange.org Git - core.git/commitdiff
Introduced isEndOfFileReached() + added a noisy debug line.
authorRoland Haeder <roland@mxchange.org>
Fri, 23 May 2014 23:32:08 +0000 (01:32 +0200)
committerRoland Haeder <roland@mxchange.org>
Fri, 23 May 2014 23:32:08 +0000 (01:32 +0200)
Signed-off-by: Roland Häder <roland@mxchange.org>
inc/classes/interfaces/io/class_Pointer.php
inc/classes/main/file_directories/class_BaseFileIo.php
inc/classes/main/iterator/io/class_FileIoIterator.php

index 7b158263479d3fcef6b647814fe458216741dc26..c17d881c219b746c470c443638d6c00306295be3 100644 (file)
@@ -45,6 +45,13 @@ interface Pointer extends FrameworkInterface {
         * @return      $fileName       The current file name
         */
        function getFileName ();
+
+       /**
+        * Determines whether the EOF has been reached
+        *
+        * @return      $isEndOfFileReached             Whether the EOF has been reached
+        */
+       function isEndOfFileReached ();
 }
 
 // [EOF]
index 845032a0980511be1f0f1a861d91a2ce38e64d5c..74e08ccc0f057476bdfd187d7f88a4dc558652c8 100644 (file)
@@ -130,6 +130,15 @@ class BaseFileIo extends BaseFrameworkSystem {
                return ftell($this->getPointer());
        }
 
+       /**
+        * Determines whether the EOF has been reached
+        *
+        * @return      $isEndOfFileReached             Whether the EOF has been reached
+        */
+       public final function isEndOfFileReached () {
+               return feof($this->getPointer());
+       }
+
        /**
         * Seek to given offset (default) or other possibilities as fseek() gives.
         *
index 7f30fb514f1577c829b7d57eeb01f53512bf98d2..97a3e3d4abf18195ca582daf231390e52cc6a88e 100644 (file)
@@ -150,9 +150,10 @@ class FileIoIterator extends BaseIterator implements SeekableWritableFileIterato
 
                // Wait until a entry/block separator has been found
                $data = $this->getBackBuffer();
-               while (!$this->getBlockInstance()->isBlockSeparatorFound($data)) {
+               while (($this->getPointerInstance()->isEndOfFileReached()) && (!$this->getBlockInstance()->isBlockSeparatorFound($data)) {
                        // Then read the block
                        $data .= $this->read($length);
+                       /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('data()=' . strlen($data));
                } // END - if
 
                /*