From 7ad507ccfba5ba6f16692cf73e6e06e9dc2829b1 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Sun, 18 May 2014 10:54:51 +0200 Subject: [PATCH] Added read(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../input/class_FrameworkFileInputPointer.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) 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; } } -- 2.39.2