Added read().
[core.git] / inc / classes / main / file_directories / input / class_FrameworkFileInputPointer.php
index e216c4b2d6bcfe28a6195aaf63b6d0fbe97b7fb7..94bb8dccb3ed8a3b9ae5981a0923f9b251d6b2a6 100644 (file)
@@ -90,7 +90,24 @@ class FrameworkFileInputPointer extends BaseFileIo implements InputPointer {
                }
 
                // Read data from the file pointer and return it
-               return fread($this->getPointer(), 1024);
+               return $this->read(1024);
+       }
+
+       /**
+        * Reads given amount of bytes from file.
+        *
+        * @param       $bytes  Amount of bytes to read
+        * @return      $data   Data read from file
+        */
+       public function read ($bytes) {
+               // Try to read given characters
+               $data = fread($this->getPointer(), $bytes);
+
+               // Was this successfull?
+               assert(is_string($data));
+
+               // Then return it
+               return $data;
        }
 }