]> git.mxchange.org Git - core.git/blobdiff - inc/classes/main/file_directories/class_BaseFileIo.php
Satisfied Pointer interface, but it will throw an exception ... ;-)
[core.git] / inc / classes / main / file_directories / class_BaseFileIo.php
index cce45b80904c0435854b5ba26d5f4fcd86f5e9ee..845032a0980511be1f0f1a861d91a2ce38e64d5c 100644 (file)
@@ -61,11 +61,10 @@ class BaseFileIo extends BaseFrameworkSystem {
 
        /**
         * Close a file source and set it's instance to null and the file name
-        * to empty
+        * to empty.
         *
         * @return      void
-        * @throws      NullPointerException    If the file pointer instance
-        *                                                                      is not set by setPointer()
+        * @throws      NullPointerException    If the file pointer instance is not set by setPointer()
         * @throws      InvalidResourceException        If there is being set
         */
        public function closeFile () {
@@ -89,15 +88,14 @@ class BaseFileIo extends BaseFrameworkSystem {
         * @param       $filePointer    File resource
         * @return      void
         */
-       public final function setPointer ($filePointer) {
+       protected final function setPointer ($filePointer) {
                $this->filePointer = $filePointer;
        }
 
        /**
         * Getter for the file pointer
         *
-        * @return      $filePointer    The file pointer which shall be a valid
-        *                                                      file resource
+        * @return      $filePointer    The file pointer which shall be a valid file resource
         */
        public final function getPointer () {
                return $this->filePointer;
@@ -109,7 +107,7 @@ class BaseFileIo extends BaseFrameworkSystem {
         * @param       $fileName       The new file name
         * @return      void
         */
-       public final function setFileName ($fileName) {
+       protected final function setFileName ($fileName) {
                $fileName = (string) $fileName;
                $this->fileName = $fileName;
        }
@@ -124,11 +122,11 @@ class BaseFileIo extends BaseFrameworkSystem {
        }
 
        /**
-        * "Getter" for seek position
+        * Determines seek position
         *
         * @return      $seekPosition   Current seek position
         */
-       public final function getSeekPosition () {
+       public final function determineSeekPosition () {
                return ftell($this->getPointer());
        }
 
@@ -144,7 +142,7 @@ class BaseFileIo extends BaseFrameworkSystem {
                $status = fseek($this->getPointer(), $offset, $whence);
 
                // Return status
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] status=%d', __METHOD__, __LINE__, $status));
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] status=%d', __METHOD__, __LINE__, $status));
                return $status;
        }
 
@@ -152,25 +150,26 @@ class BaseFileIo extends BaseFrameworkSystem {
         * Size of this file
         *
         * @return      $size   Size (in bytes) of file
+        * @todo        Handle seekStatus
         */
        public function size () {
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] CALLED!', __METHOD__, __LINE__));
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] CALLED!', __METHOD__, __LINE__));
 
                // Get current seek position
-               $seekPosition = $this->getSeekPosition();
+               $seekPosition = $this->determineSeekPosition();
 
                // Seek to end
                $seekStatus = $this->seek(0, SEEK_END);
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] seekStatus=%d', __METHOD__, __LINE__, $seekStatus));
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] seekStatus=%d', __METHOD__, __LINE__, $seekStatus));
 
                // Get position again  (which is the end of the file)
-               $size = $this->getSeekPosition();
+               $size = $this->determineSeekPosition();
 
                // Reset seek position to old
                $this->seek($seekPosition);
 
                // Return size
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] size=%s - EXIT!', __METHOD__, __LINE__, $size));
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] size=%s - EXIT!', __METHOD__, __LINE__, $size));
                return $size;
        }
 }