]> git.mxchange.org Git - core.git/commitdiff
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 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;
        }
 }