Added read().
authorRoland Haeder <roland@mxchange.org>
Sun, 18 May 2014 08:54:51 +0000 (10:54 +0200)
committerRoland Haeder <roland@mxchange.org>
Sun, 18 May 2014 08:54:51 +0000 (10:54 +0200)
Signed-off-by: Roland H├Ąder <roland@mxchange.org>
inc/classes/main/file_directories/input/class_FrameworkFileInputPointer.php

index e216c4b..94bb8dc 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;
        }
 }