]> git.mxchange.org Git - core.git/blobdiff - framework/main/classes/file_directories/class_BaseFileIo.php
Continued:
[core.git] / framework / main / classes / file_directories / class_BaseFileIo.php
index ae783af683b7fac4d0a4c7dcdd3df223421d95b6..c934ecb5b1a4944a995a885dc295901a7d2e140f 100644 (file)
@@ -49,7 +49,11 @@ abstract class BaseFileIo extends BaseFrameworkSystem implements FilePointer, Cl
         */
        protected function __construct (string $className) {
                // Call parent constructor
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-FILE-IO: className=%s - CONSTRUCTED!', $className));
                parent::__construct($className);
+
+               // Trace message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-FILE-IO: EXIT!');
        }
 
        /**
@@ -59,10 +63,10 @@ abstract class BaseFileIo extends BaseFrameworkSystem implements FilePointer, Cl
         */
        public final function __destruct() {
                // Is there a resource pointer? Then we have to close the file here!
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-IO: this->fileObject[]=%s - DESTRUCTOR!', gettype($this->getFileObject())));
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-FILE-IO: this->fileObject[]=%s - DESTRUCTOR!', gettype($this->getFileObject())));
                if (is_object($this->getFileObject())) {
                        // Try to close a file
-                       //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FILE-IO: Invoking this->closeFile() ...');
+                       /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-FILE-IO: Invoking this->closeFile() ...');
                        $this->closeFile();
                }
 
@@ -70,7 +74,7 @@ abstract class BaseFileIo extends BaseFrameworkSystem implements FilePointer, Cl
                parent::__destruct();
 
                // Trace message
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FILE-IO: EXIT!');
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-FILE-IO: EXIT!');
        }
 
        /**
@@ -83,7 +87,7 @@ abstract class BaseFileIo extends BaseFrameworkSystem implements FilePointer, Cl
         */
        public function closeFile () {
                // Validate parameter
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-IO: fileName=%s - CALLED!', $this->getFileObject()->getPathname()));
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-FILE-IO: fileName=%s - CALLED!', $this->getFileObject()->getPathname()));
                if (is_null($this->getFileObject())) {
                        // Pointer not initialized
                        throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
@@ -93,11 +97,11 @@ abstract class BaseFileIo extends BaseFrameworkSystem implements FilePointer, Cl
                }
 
                // Close the file pointer by NULL-ing it
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-IO: Closing file %s ...', $this->getFileObject()->getPathname()));
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('BASE-FILE-IO: Closing file %s ...', $this->getFileObject()->getPathname()));
                $this->resetFileObject();
 
                // Trace message
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FILE-IO: EXIT!');
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-FILE-IO: EXIT!');
        }
 
        /**
@@ -107,7 +111,11 @@ abstract class BaseFileIo extends BaseFrameworkSystem implements FilePointer, Cl
         */
        protected final function resetFileObject () {
                // Set it to NULL
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-FILE-IO: Setting this->fileObject=NULL - CALLED!');
                $this->fileObject = NULL;
+
+               // Trace message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-FILE-IO: EXIT!');
        }
 
        /**
@@ -156,7 +164,7 @@ abstract class BaseFileIo extends BaseFrameworkSystem implements FilePointer, Cl
         */
        public function seek (int $offset, int $whence = SEEK_SET) {
                // Validate parameter
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-IO: offset=%d,whence=%d - CALLED!', $offset, $whence));
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-FILE-IO: offset=%d,whence=%d - CALLED!', $offset, $whence));
                if ($offset < 0) {
                        // Throw exception
                        throw new OutOfBoundsException(sprintf('offset=%d is not valid', $offset));
@@ -166,7 +174,7 @@ abstract class BaseFileIo extends BaseFrameworkSystem implements FilePointer, Cl
                $status = $this->getFileObject()->fseek($offset, $whence);
 
                // Return status
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-IO: status=%d - EXIT!', $status));
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-FILE-IO: status=%d - EXIT!', $status));
                return $status;
        }
 
@@ -178,22 +186,22 @@ abstract class BaseFileIo extends BaseFrameworkSystem implements FilePointer, Cl
         */
        public function size () {
                // Get current seek position
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FILE-IO: CALLED!');
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-FILE-IO: CALLED!');
                $seekPosition = $this->determineSeekPosition();
 
                // Seek to end
                $seekStatus = $this->seek(0, SEEK_END);
 
                // Get position again (which is the end of the file)
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-IO: seekStatus[%s]=%d', gettype($seekStatus), $seekStatus));
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('BASE-FILE-IO: seekStatus[%s]=%d', gettype($seekStatus), $seekStatus));
                $size = $this->determineSeekPosition();
 
                // Reset seek position to old
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-IO: size[%s]=%d', gettype($size), $size));
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('BASE-FILE-IO: size[%s]=%d', gettype($size), $size));
                $this->seek($seekPosition);
 
                // Return size
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-IO: size=%d - EXIT!', $size));
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-FILE-IO: size=%d - EXIT!', $size));
                return $size;
        }