}
// First seek to it, if file size is larger than zero
- if ($this->getFileSize() > 0 && !$this->seek($seekPosition)) {
+ if (($this->getFileSize() > 0 || $seekPosition > 0) && $this->seek($seekPosition) === -1) {
// Could not seek
throw new InvalidArgumentException(sprintf('Could not seek to seekPosition=%d', $seekPosition));
}
/**
* Rewinds to the beginning of the file
*
- * @return $status Status of this operation
+ * @return void
*/
public function rewind () {
// Rewind the pointer
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FILE-INPUT-OUTPUT-POINTER: CALLED!');
- return $this->getFileObject()->rewind();
+ $this->getFileObject()->rewind();
+
+ // Trace message
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FILE-INPUT-OUTPUT-POINTER: EXIT!');
}
/**
*/
public function read (int $bytes = 0) {
// Validatre parameter
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FILE-INPUT-OUTPUT-POINTER: bytes=%d - CALLED!', $bytes));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FILE-INPUT-OUTPUT-POINTER: bytes=%d - CALLED!', $bytes));
if ($bytes < 0) {
// Bytes cannot be lesser than zero
throw new InvalidArgumentException(sprintf('bytes=%d is not valid', $bytes));
}
// Then return it
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FILE-INPUT-OUTPUT-POINTER: data[%s]=%s - EXIT!', gettype($data), $data));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FILE-INPUT-OUTPUT-POINTER: data[%s]=%s - EXIT!', gettype($data), $data));
return $data;
}