}
/**
- * Read data a file pointer
+ * Read 1024 bytes data from a file pointer
*
* @return mixed The result of fread()
* @throws NullPointerException If the file pointer instance
}
// Read data from the file pointer and return it
- return fread($this->getPointer(), 1024);
+ return $this->read(1024);
}
/**
// Move the file pointer
return fseek($this->getPointer(), $seekPosition, $whence);
}
+
+ /**
+ * 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;
+ }
}
// [EOF]