X-Git-Url: https://git.mxchange.org/?p=core.git;a=blobdiff_plain;f=inc%2Fclasses%2Fmain%2Ffile_directories%2Fio%2Fclass_FrameworkFileInputOutputPointer.php;h=ec6c0e9ba14c71a9dd5685e1cc30540b754afaa7;hp=0a750029371e42a9bb173954dd2b0fc728578871;hb=1a91dabdfed365947d1ce11675aacae9d424edff;hpb=e65d661719c78867ff57607457c8abfaae2e2ee3 diff --git a/inc/classes/main/file_directories/io/class_FrameworkFileInputOutputPointer.php b/inc/classes/main/file_directories/io/class_FrameworkFileInputOutputPointer.php index 0a750029..ec6c0e9b 100644 --- a/inc/classes/main/file_directories/io/class_FrameworkFileInputOutputPointer.php +++ b/inc/classes/main/file_directories/io/class_FrameworkFileInputOutputPointer.php @@ -167,21 +167,34 @@ class FrameworkFileInputOutputPointer extends BaseFileIo implements InputOutputP return fseek($this->getPointer(), $seekPosition, $whence); } + /** + * Reads a line, maximum 4096 Bytes from current file pointer + * + * @return $data Read data from file + */ + public function readLine () { + // Read whole line + return $this->read(); + } + /** * Reads given amount of bytes from file. * * @param $bytes Amount of bytes to read * @return $data Data read from file */ - public function read ($bytes) { + public function read ($bytes = NULL) { // Validate the pointer $this->validateFilePointer(); - // Try to read given characters - $data = fread($this->getPointer(), $bytes); - - // Was this successfull? - assert(is_string($data)); + // Is $bytes set? + if (is_int($bytes)) { + // Try to read given characters + $data = fread($this->getPointer(), $bytes); + } else { + // Try to read whole line + $data = fread($this->getPointer()); + } // Then return it return $data;