From: Roland Haeder Date: Sun, 18 May 2014 08:54:51 +0000 (+0200) Subject: Added read(). X-Git-Url: https://git.mxchange.org/?p=core.git;a=commitdiff_plain;h=7ad507ccfba5ba6f16692cf73e6e06e9dc2829b1;hp=603435f373f9d92dc4576d816dd4d6e18c8da05b Added read(). Signed-off-by: Roland Häder --- diff --git a/inc/classes/main/file_directories/input/class_FrameworkFileInputPointer.php b/inc/classes/main/file_directories/input/class_FrameworkFileInputPointer.php index e216c4b2..94bb8dcc 100644 --- a/inc/classes/main/file_directories/input/class_FrameworkFileInputPointer.php +++ b/inc/classes/main/file_directories/input/class_FrameworkFileInputPointer.php @@ -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; } }