]> git.mxchange.org Git - core.git/blobdiff - inc/classes/main/iterator/io/class_FileIoIterator.php
Added new interfaces for file i/o classes.
[core.git] / inc / classes / main / iterator / io / class_FileIoIterator.php
index 1791e6150c465fef0f07bd071c044505b16ac4b8..03c0c25b2f81747e00e17c6c4f422af2a8e58cd5 100644 (file)
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
-class FileIoIterator extends BaseIterator implements SeekableFileIterator {
+class FileIoIterator extends BaseIterator implements SeekableWritableFileIterator {
+       /**
+        * Current absolute seek position (returned by key())
+        */
+       private $seekPosition = FALSE;
+
+       /**
+        * Total entries (read from file)
+        */
+       private $totalEntriesFile = FALSE;
+
        /**
         * Protected constructor
         *
@@ -35,10 +45,10 @@ class FileIoIterator extends BaseIterator implements SeekableFileIterator {
        /**
         * Creates an instance of this class
         *
-        * @param       $pointerInstance        An instance of a FrameworkFileInputOutputPointer class
+        * @param       $pointerInstance        An instance of a InputOutputPointer class
         * @return      $iteratorInstance       An instance of a Iterator class
         */
-       public final static function createFileIoIterator (FrameworkFileInputOutputPointer $pointerInstance) {
+       public final static function createFileIoIterator (InputOutputPointer $pointerInstance) {
                // Get new instance
                $iteratorInstance = new FileIoIterator();
 
@@ -107,6 +117,19 @@ class FileIoIterator extends BaseIterator implements SeekableFileIterator {
                $this->partialStub('Please implement this method. seekPosition=' . $seekPosition);
        }
 
+       /**
+        * Size of file stack
+        *
+        * @return      $size   Size (in bytes) of file
+        */
+       public function size () {
+               // Call the pointer object
+               $size = $this->getPointerInstance()->size();
+
+               // Return result
+               return $size;
+       }
+
        /**
         * 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.