writeAtPosition() also belongs in OutputPointer classes.
[core.git] / inc / classes / main / file_directories / io / class_FrameworkFileInputOutputPointer.php
index fb1762ad437c8f954037700ad4671773b715f5fd..05d064d8de3a670e6f686f5f9d08f49bdf9838a2 100644 (file)
@@ -124,6 +124,21 @@ class FrameworkFileInputOutputPointer extends BaseFileIo implements InputOutputP
                return fwrite($this->getPointer(), $dataStream, strlen($dataStream));
        }
 
+       /**
+        * Writes at given position by seeking to it.
+        *
+        * @param       $seekPosition   Seek position in file
+        * @param       $data                   Data to be written
+        * @return      mixed                   Number of writes bytes or FALSE on error
+        */
+       public function writeAtPosition ($seekPosition, $data) {
+               // First seek to it
+               $this->seek($seekPosition);
+
+               // Then write the data at that position
+               return $this->getBlockInstance()->writeToFile($data);
+       }
+
        /**
         * Rewinds to the beginning of the file
         *