Continued CSV parsing:
[core.git] / inc / classes / main / file_directories / io / class_FrameworkFileInputOutputPointer.php
index 0a75002..ec6c0e9 100644 (file)
@@ -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;