From: Roland Haeder Date: Fri, 23 May 2014 23:32:08 +0000 (+0200) Subject: Introduced isEndOfFileReached() + added a noisy debug line. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=6e04a11b7ef92c13108b6cfb3e94786a8782eecc;p=core.git Introduced isEndOfFileReached() + added a noisy debug line. Signed-off-by: Roland Häder --- diff --git a/inc/classes/interfaces/io/class_Pointer.php b/inc/classes/interfaces/io/class_Pointer.php index 7b158263..c17d881c 100644 --- a/inc/classes/interfaces/io/class_Pointer.php +++ b/inc/classes/interfaces/io/class_Pointer.php @@ -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] diff --git a/inc/classes/main/file_directories/class_BaseFileIo.php b/inc/classes/main/file_directories/class_BaseFileIo.php index 845032a0..74e08ccc 100644 --- a/inc/classes/main/file_directories/class_BaseFileIo.php +++ b/inc/classes/main/file_directories/class_BaseFileIo.php @@ -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. * diff --git a/inc/classes/main/iterator/io/class_FileIoIterator.php b/inc/classes/main/iterator/io/class_FileIoIterator.php index 7f30fb51..97a3e3d4 100644 --- a/inc/classes/main/iterator/io/class_FileIoIterator.php +++ b/inc/classes/main/iterator/io/class_FileIoIterator.php @@ -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 /*