* an invalid file resource
*/
function writeToFile ($dataStream);
+
+ /**
+ * Writes at given position by seeking to it.
+ *
+ * @param $seekPosition Seek position in file
+ * @param $data Data to be written
+ * @return mixed Number of writes bytes or FALSE on error
+ */
+ function writeAtPosition ($seedPosition, $data);
}
// [EOF]
*/
function size ();
- /**
- * Writes at given position by seeking to it.
- *
- * @param $seekPosition Seek position in file
- * @param $data Data to be written
- * @return void
- */
- function writeAtPosition ($seedPosition, $data);
-
/**
* Reads given amount of bytes from file.
*
return fwrite($this->getPointer(), $dataStream, strlen($dataStream));
}
+ /**
+ * Writes at given position by seeking to it.
+ *
+ * @param $seekPosition Seek position in file
+ * @param $data Data to be written
+ * @return mixed Number of writes bytes or FALSE on error
+ */
+ public function writeAtPosition ($seekPosition, $data) {
+ // First seek to it
+ $this->seek($seekPosition);
+
+ // Then write the data at that position
+ return $this->getBlockInstance()->writeToFile($data);
+ }
+
/**
* Rewinds to the beginning of the file
*
);
// Write it to disk (header is always at seek position 0)
- $this->writeData(0, $header, FALSE);
+ $this->getIteratorInstance()->writeData(0, $header, FALSE);
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] EXIT!', __METHOD__, __LINE__));
}
return $this->getBlockInstance()->seek($seekPosition);
}
- /**
- * Writes at given position by seeking to it.
- *
- * @param $seekPosition Seek position in file
- * @param $data Data to be written
- * @return void
- */
- public function writeAtPosition ($seekPosition, $data) {
- // First seek to it
- $this->seek($seekPosition);
-
- // Then write the data at that position
- $this->getBlockInstance()->writeToFile($data);
- }
-
/**
* Size of file stack
*
chr(BaseBinaryFile::SEPARATOR_HEADER_DATA),
// Position (will be zero)
- str_pad($this->dec2hex($this->getSeekPosition(), 2), BaseBinaryFile::LENGTH_POSITION, '0', STR_PAD_LEFT),
+ str_pad($this->dec2hex($this->getIteratorInstance()->getSeekPosition(), 2), BaseBinaryFile::LENGTH_POSITION, '0', STR_PAD_LEFT),
// Separator position<->entries
chr(BaseBinaryFile::SEPARATOR_HEADER_ENTRIES)
);
// Write it to disk (header is always at seek position 0)
- $this->writeData(0, $header, FALSE);
+ $this->getIteratorInstance()->writeData(0, $header, FALSE);
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] EXIT!', __METHOD__, __LINE__));
}