* @return void
* @todo To hard assertions here, better rewrite them to exceptions
*/
- protected function readFileHeader () {
+ public function readFileHeader () {
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] CALLED!', __METHOD__, __LINE__));
// First rewind to beginning as the header sits at the beginning ...
*
* @return void
*/
- protected function flushFileHeader () {
+ public function flushFileHeader () {
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] CALLED!', __METHOD__, __LINE__));
// Put all informations together
*/
protected function initFileStack ($fileName, $type) {
// Get a stack file instance
- $fileInstance = ObjectFactory::createObjectByConfiguredName('stack_file_class', array($fileName));
+ $fileInstance = ObjectFactory::createObjectByConfiguredName('stack_file_class', array($fileName, $this));
// Get iterator instance
- $iteratorInstance = ObjectFactory::createObjectByConfiguredName('file_io_iterator_class', array($fileInstance, $this));
+ $iteratorInstance = ObjectFactory::createObjectByConfiguredName('file_iterator_class', array($fileInstance));
// Is the instance implementing the right interface?
assert($iteratorInstance instanceof SeekableWritableFileIterator);
throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getPointerInstance()), self::EXCEPTION_UNSPPORTED_OPERATION);
}
+ /**
+ * Close a file source and set it's instance to null and the file name
+ * to empty.
+ *
+ * @return void
+ * @throws UnsupportedOperationException This method is not (and maybe never will be) supported
+ */
+ public function closeFile () {
+ throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getPointerInstance()), self::EXCEPTION_UNSPPORTED_OPERATION);
+ }
+
+ /**
+ * Determines whether the EOF has been reached
+ *
+ * @return $isEndOfFileReached Whether the EOF has been reached
+ * @throws UnsupportedOperationException This method is not (and maybe never will be) supported
+ */
+ public function isEndOfFileReached () {
+ throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getPointerInstance()), self::EXCEPTION_UNSPPORTED_OPERATION);
+ }
+
+ /**
+ * Getter for file name
+ *
+ * @return $fileName The current file name
+ * @throws UnsupportedOperationException This method is not (and maybe never will be) supported
+ */
+ public function getFileName () {
+ throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getPointerInstance()), self::EXCEPTION_UNSPPORTED_OPERATION);
+ }
+
/**
* Getter for size of given stack (array count)
*
*
* @return $length Minimum length for one entry/block
*/
- public function caluclateMinimumBlockLength () {
+ public function calculateMinimumBlockLength () {
// Calulcate it
$length = self::getHashLength() + strlen(chr(self::SEPARATOR_HASH_NAME)) + self::LENGTH_NAME + 1 + strlen(self::getBlockSeparator());