]> git.mxchange.org Git - core.git/blobdiff - framework/main/classes/file_directories/io/class_FrameworkFileInputOutputPointer.php
Rewrites:
[core.git] / framework / main / classes / file_directories / io / class_FrameworkFileInputOutputPointer.php
index 4e79954fad93332afea415cd7348f92db2a45bfa..2805546ff35208997b53fef82e19eeab0b482ff7 100644 (file)
@@ -149,7 +149,7 @@ class FrameworkFileInputOutputPointer extends BaseFileIo implements InputOutputP
                }
 
                // First seek to it, if file size is larger than zero
-               if ($this->getFileSize() > 0 && !$this->seek($seekPosition)) {
+               if (($this->getFileSize() > 0 || $seekPosition > 0) && $this->seek($seekPosition) === -1) {
                        // Could not seek
                        throw new InvalidArgumentException(sprintf('Could not seek to seekPosition=%d', $seekPosition));
                }
@@ -165,12 +165,15 @@ class FrameworkFileInputOutputPointer extends BaseFileIo implements InputOutputP
        /**
         * Rewinds to the beginning of the file
         *
-        * @return      $status         Status of this operation
+        * @return      void
         */
        public function rewind () {
                // Rewind the pointer
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FILE-INPUT-OUTPUT-POINTER: CALLED!');
-               return $this->getFileObject()->rewind();
+               $this->getFileObject()->rewind();
+
+               // Trace message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FILE-INPUT-OUTPUT-POINTER: EXIT!');
        }
 
        /**
@@ -217,7 +220,7 @@ class FrameworkFileInputOutputPointer extends BaseFileIo implements InputOutputP
         */
        public function read (int $bytes = 0) {
                // Validatre parameter
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FILE-INPUT-OUTPUT-POINTER: bytes=%d - CALLED!', $bytes));
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FILE-INPUT-OUTPUT-POINTER: bytes=%d - CALLED!', $bytes));
                if ($bytes < 0) {
                        // Bytes cannot be lesser than zero
                        throw new InvalidArgumentException(sprintf('bytes=%d is not valid', $bytes));
@@ -233,7 +236,7 @@ class FrameworkFileInputOutputPointer extends BaseFileIo implements InputOutputP
                }
 
                // Then return it
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FILE-INPUT-OUTPUT-POINTER: data[%s]=%s - EXIT!', gettype($data), $data));
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FILE-INPUT-OUTPUT-POINTER: data[%s]=%s - EXIT!', gettype($data), $data));
                return $data;
        }