Added more methods (required).
authorRoland Haeder <roland@mxchange.org>
Sat, 24 May 2014 12:09:10 +0000 (14:09 +0200)
committerRoland Haeder <roland@mxchange.org>
Sat, 24 May 2014 12:09:10 +0000 (14:09 +0200)
Signed-off-by: Roland Häder <roland@mxchange.org>
inc/classes/interfaces/io/pointer/io/class_InputOutputPointer.php
inc/classes/main/file_directories/class_BaseFile.php

index 93846ff7311813ecb80372d66a6b8c663b0c4256..0cb98dd847801d3cb036a5701bb0d4192b2fe342 100644 (file)
@@ -28,6 +28,29 @@ interface InputOutputPointer extends InputPointer, OutputPointer {
         * @return      $status         Status of this operation
         */
        function rewind ();
+
+       /**
+        * Advances to next "block" of bytes
+        *
+        * @return      void
+        * @todo        This method will load large but empty files in a whole
+        */
+       function next ();
+
+       /**
+        * Checks wether the current entry is valid (not at the end of the file).
+        * This method will return TRUE if an emptied (nulled) entry has been found.
+        *
+        * @return      $isValid        Whether the next entry is valid
+        */
+       function valid ();
+
+       /**
+        * Gets current seek position ("key").
+        *
+        * @return      $key    Current key in iteration
+        */
+       function key ();
 }
 
 // [EOF]
index 3d1711e72fecef8057a2eabbb06dbf17ab50b106..303371c6791e25579d226e7a0f32693f8f577a1f 100644 (file)
@@ -141,6 +141,16 @@ y   * @return      void
                $this->currentBlock = $currentBlock;
        }
 
+       /**
+        * Gets currently read data
+        *
+        * @return      $current        Currently read data
+        */
+       public function getCurrentBlock () {
+               // Return it
+               return $this->currentBlock;
+       }
+
        /**
         * Initializes this file class
         *
@@ -289,7 +299,7 @@ y    * @return      void
                        $this->next();
 
                        // Get current entry
-                       $current = $this->current();
+                       $current = $this->getCurrentBlock();
 
                        // Simply output it
                        self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] current=%s', __METHOD__, __LINE__, print_r($current, TRUE)));
@@ -397,6 +407,16 @@ y   * @return      void
                // Return result
                return $isValid;
        }
+
+       /**
+        * Gets current seek position ("key").
+        *
+        * @return      $key    Current key in iteration
+        */
+       public function key () {
+               // Call pointer instance
+               return $this->getPointerInstance()->determineSeekPosition();
+       }
 }
 
 // [EOF]