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;