- fixed bad calls on no-longer existing iterator
Signed-off-by: Roland Häder <roland@mxchange.org>
// Left part is the actual block, right one the back-buffer data, if found
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-BINARY-FILE: dataArray()=%d', count($dataArray)));
// Left part is the actual block, right one the back-buffer data, if found
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-BINARY-FILE: dataArray()=%d', count($dataArray)));
- /* PRINTR-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-BINARY-FILE: dataArray=%s', print_r($dataArray, true)));
+ //* PRINTR-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-BINARY-FILE: dataArray=%s', print_r($dataArray, true)));
$this->setCurrentBlock($dataArray[0]);
// Is back buffere data found?
$this->setCurrentBlock($dataArray[0]);
// Is back buffere data found?
// Gap position cannot be smaller or equal than header length
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FILE-STACK-INDEX: stackName=%s,hash=%s,gapPosition=%s', $stackName, $data[StackableFile::ARRAY_NAME_HASH], $gapPosition));
// Gap position cannot be smaller or equal than header length
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FILE-STACK-INDEX: stackName=%s,hash=%s,gapPosition=%s', $stackName, $data[StackableFile::ARRAY_NAME_HASH], $gapPosition));
- if ($gapPosition <= ($this->getIteratorInstance()->getHeaderSize() + 1)) {
+ if ($gapPosition <= ($this->getIteratorInstance()->getBinaryFileInstance()->getHeaderSize() + 1)) {
// Not valid gap position returned
// Not valid gap position returned
- throw new UnexpectedValueException(sprintf('gapPosition[%s]=%d is smaller or equal headerSize+1=%d', gettype($gapPosition), $gapPosition, ($this->getIteratorInstance()->getHeaderSize() + 1)));
+ throw new UnexpectedValueException(sprintf('gapPosition[%s]=%d is smaller or equal headerSize+1=%d', gettype($gapPosition), $gapPosition, ($this->getIteratorInstance()->getBinaryFileInstance()->getHeaderSize() + 1)));
}
// Then write the data at that gap
}
// Then write the data at that gap
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FILE-STACK: CALLED!');
$this->getIteratorInstance()->rewind();
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FILE-STACK: CALLED!');
$this->getIteratorInstance()->rewind();
+ // Get header size
+ $headerSize = $this->getIteratorInstance()->getBinaryFileInstance()->getHeaderSize();
+
// Then read it (see constructor for calculation)
// Then read it (see constructor for calculation)
- $data = $this->getIteratorInstance()->read($this->getIteratorInstance()->getHeaderSize());
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: headerSize=%d', $headerSize));
+ $data = $this->getIteratorInstance()->getBinaryFileInstance()->read($headerSize);
// Have all requested bytes been read?
// Have all requested bytes been read?
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: Read %d bytes (%d wanted).', strlen($data), $this->getIteratorInstance()->getHeaderSize()));
- if (strlen($data) != $this->getIteratorInstance()->getHeaderSize()) {
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: Read %d bytes (%d wanted).', strlen($data), $this->getIteratorInstance()->getBinaryFileInstance()->getHeaderSize()));
+ if (strlen($data) != $this->getIteratorInstance()->getBinaryFileInstance()->getHeaderSize()) {
// Bad data length
throw new UnexpectedValueException(sprintf('data(%d)=%s does not match iteratorInstance->headerSize=%d',
strlen($data),
$data,
// Bad data length
throw new UnexpectedValueException(sprintf('data(%d)=%s does not match iteratorInstance->headerSize=%d',
strlen($data),
$data,
- $this->getIteratorInstance()->getHeaderSize()
+ $this->getIteratorInstance()->getBinaryFileInstance()->getHeaderSize()
));
} elseif (empty(trim($data, chr(0)))) {
// Empty header, file is freshly pre-allocated
));
} elseif (empty(trim($data, chr(0)))) {
// Empty header, file is freshly pre-allocated
// And update seek position
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FILE-STACK: Calling this->iteratorInstance->updateSeekPosition() ...');
// And update seek position
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FILE-STACK: Calling this->iteratorInstance->updateSeekPosition() ...');
- $this->getIteratorInstance()->updateSeekPosition();
+ $this->getIteratorInstance()->getBinaryFileInstance()->updateSeekPosition();
$header[2] = hex2bin($header[2]);
// Set header here
$header[2] = hex2bin($header[2]);
// Set header here
- $this->getIteratorInstance()->setHeader($header);
+ $this->getIteratorInstance()->getBinaryFileInstance()->setHeader($header);
// Trace message
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FILE-STACK: EXIT!');
// Trace message
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FILE-STACK: EXIT!');
chr(BaseBinaryFile::SEPARATOR_HEADER_DATA),
// Padded total entries
chr(BaseBinaryFile::SEPARATOR_HEADER_DATA),
// Padded total entries
- str_pad(StringUtils::dec2hex($this->getIteratorInstance()->getCounter()), BaseBinaryFile::LENGTH_COUNT, '0', STR_PAD_LEFT),
+ str_pad(StringUtils::dec2hex($this->getIteratorInstance()->getBinaryFileInstance()->getCounter()), BaseBinaryFile::LENGTH_COUNT, '0', STR_PAD_LEFT),
// Separator count<->seek position
chr(BaseBinaryFile::SEPARATOR_HEADER_DATA),
// Padded seek position
// Separator count<->seek position
chr(BaseBinaryFile::SEPARATOR_HEADER_DATA),
// Padded seek position
- str_pad(StringUtils::dec2hex($this->getIteratorInstance()->getSeekPosition(), 2), BaseBinaryFile::LENGTH_POSITION, '0', STR_PAD_LEFT),
+ str_pad(StringUtils::dec2hex($this->getIteratorInstance()->getBinaryFileInstance()->getSeekPosition(), 2), BaseBinaryFile::LENGTH_POSITION, '0', STR_PAD_LEFT),
// Separator position<->entries
chr(BaseBinaryFile::SEPARATOR_HEADER_ENTRIES)
// Separator position<->entries
chr(BaseBinaryFile::SEPARATOR_HEADER_ENTRIES)
// Write it to disk (header is always at seek position 0)
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: Calling this->iteratorInstance->writeAtPosition(0, header=%s) ...', $header));
// Write it to disk (header is always at seek position 0)
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: Calling this->iteratorInstance->writeAtPosition(0, header=%s) ...', $header));
- $this->getIteratorInstance()->writeAtPosition(0, $header);
+ $this->getIteratorInstance()->getBinaryFileInstance()->writeAtPosition(0, $header);
// Trace message
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FILE-STACK: EXIT!');
// Trace message
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FILE-STACK: EXIT!');
// Setting it
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: Setting headerSize=%d ...', $headerSize));
// Setting it
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: Setting headerSize=%d ...', $headerSize));
- $this->getIteratorInstance()->setHeaderSize($headerSize);
+ $this->getIteratorInstance()->getBinaryFileInstance()->setHeaderSize($headerSize);
// Init counters and gaps array
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FILE-STACK: Calling this->iteratorInstance->initCountersGapsArray() ...');
// Init counters and gaps array
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FILE-STACK: Calling this->iteratorInstance->initCountersGapsArray() ...');
- $this->getIteratorInstance()->initCountersGapsArray();
+ $this->getIteratorInstance()->getBinaryFileInstance()->initCountersGapsArray();
/*
* Get stack index instance. This can be used for faster
/*
* Get stack index instance. This can be used for faster
$this->setIndexInstance($indexInstance);
// Is the file's header initialized?
$this->setIndexInstance($indexInstance);
// Is the file's header initialized?
- if (!$this->getIteratorInstance()->isFileHeaderInitialized()) {
+ if (!$this->getIteratorInstance()->getBinaryFileInstance()->isFileHeaderInitialized()) {
// First pre-allocate a bit
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FILE-STACK: Calling this->iteratorInstance->preAllocateFile(file_stack) ...');
// First pre-allocate a bit
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FILE-STACK: Calling this->iteratorInstance->preAllocateFile(file_stack) ...');
- $this->getIteratorInstance()->preAllocateFile('file_stack');
+ $this->getIteratorInstance()->getBinaryFileInstance()->preAllocateFile('file_stack');
// Then create file header
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FILE-STACK: this->iteratorInstance->createFileHeader() ...');
// Then create file header
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FILE-STACK: this->iteratorInstance->createFileHeader() ...');
- $this->getIteratorInstance()->createFileHeader();
+ $this->getIteratorInstance()->getBinaryFileInstance()->createFileHeader();
}
// Load the file header
}
// Load the file header
* be analyzed and the index rebuild.
*/
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FILE-STACK: Calling this->iteratorInstance->analyzeFileStructure() ...');
* be analyzed and the index rebuild.
*/
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FILE-STACK: Calling this->iteratorInstance->analyzeFileStructure() ...');
- $this->getIteratorInstance()->analyzeFileStructure();
+ $this->getIteratorInstance()->getBinaryFileInstance()->analyzeFileStructure();
// Rebuild index from file
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: Calling this->iteratorInstance->rebuildIndexFromStack(%s) ...', $this->__toString()));
// Rebuild index from file
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: Calling this->iteratorInstance->rebuildIndexFromStack(%s) ...', $this->__toString()));
* Now add the value to the file stack which returns gap position, a
* hash and length of the raw data.
*/
* Now add the value to the file stack which returns gap position, a
* hash and length of the raw data.
*/
- $data = $this->getIteratorInstance()->writeValueToFile($stackerName, $value);
+ $data = $this->getIteratorInstance()->getBinaryFileInstance()->writeValueToFile($stackerName, $value);
// Add the hash and gap position to the index
//* PRINTR-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: data=%s', print_r($data, true));
// Add the hash and gap position to the index
//* PRINTR-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: data=%s', print_r($data, true));
* @throws UnsupportedOperationException This method is not (and maybe never will be) supported
*/
public function isStackInitialized (string $stackerName) {
* @throws UnsupportedOperationException This method is not (and maybe never will be) supported
*/
public function isStackInitialized (string $stackerName) {
- throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getPointerInstance()), self::EXCEPTION_UNSPPORTED_OPERATION);
+ throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getBinaryFileInstance()), self::EXCEPTION_UNSPPORTED_OPERATION);
* @throws UnsupportedOperationException This method is not (and maybe never will be) supported
*/
public function isEndOfFileReached () {
* @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);
+ throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getBinaryFileInstance()), self::EXCEPTION_UNSPPORTED_OPERATION);
public function getStackCount (string $stackerName) {
// Now, simply return the found count value, this must be up-to-date then!
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: stackerName=%s - CALLED!', $stackerName));
public function getStackCount (string $stackerName) {
// Now, simply return the found count value, this must be up-to-date then!
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: stackerName=%s - CALLED!', $stackerName));
- $count = $this->getIteratorInstance()->getCounter();
+ $count = $this->getIteratorInstance()->getBinaryFileInstance()->getCounter();
// Return count
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: count=%d - EXIT!', $count));
// Return count
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: count=%d - EXIT!', $count));
* @throws UnsupportedOperationException This method is not (and maybe never will be) supported
*/
public function initCountersGapsArray () {
* @throws UnsupportedOperationException This method is not (and maybe never will be) supported
*/
public function initCountersGapsArray () {
- throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getPointerInstance()), self::EXCEPTION_UNSPPORTED_OPERATION);
+ throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getBinaryFileInstance()), self::EXCEPTION_UNSPPORTED_OPERATION);
* @throws UnsupportedOperationException This method is not (and maybe never will be) supported
*/
public final function getHeaderSize () {
* @throws UnsupportedOperationException This method is not (and maybe never will be) supported
*/
public final function getHeaderSize () {
- throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getPointerInstance()), self::EXCEPTION_UNSPPORTED_OPERATION);
+ throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getBinaryFileInstance()), self::EXCEPTION_UNSPPORTED_OPERATION);
* @throws UnsupportedOperationException This method is not (and maybe never will be) supported
*/
public final function setHeaderSize (int $headerSize) {
* @throws UnsupportedOperationException This method is not (and maybe never will be) supported
*/
public final function setHeaderSize (int $headerSize) {
- throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getPointerInstance()), self::EXCEPTION_UNSPPORTED_OPERATION);
+ throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getBinaryFileInstance()), self::EXCEPTION_UNSPPORTED_OPERATION);
* @throws UnsupportedOperationException This method is not (and maybe never will be) supported
*/
public final function getHeader () {
* @throws UnsupportedOperationException This method is not (and maybe never will be) supported
*/
public final function getHeader () {
- throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getPointerInstance()), self::EXCEPTION_UNSPPORTED_OPERATION);
+ throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getBinaryFileInstance()), self::EXCEPTION_UNSPPORTED_OPERATION);
* @throws UnsupportedOperationException This method is not (and maybe never will be) supported
*/
public final function setHeader (array $header) {
* @throws UnsupportedOperationException This method is not (and maybe never will be) supported
*/
public final function setHeader (array $header) {
- throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getPointerInstance()), self::EXCEPTION_UNSPPORTED_OPERATION);
+ throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getBinaryFileInstance()), self::EXCEPTION_UNSPPORTED_OPERATION);
* @throws UnsupportedOperationException This method is not (and maybe never will be) supported
*/
public function updateSeekPosition () {
* @throws UnsupportedOperationException This method is not (and maybe never will be) supported
*/
public function updateSeekPosition () {
- throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getPointerInstance()), self::EXCEPTION_UNSPPORTED_OPERATION);
+ throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getBinaryFileInstance()), self::EXCEPTION_UNSPPORTED_OPERATION);
* @throws UnsupportedOperationException This method is not (and maybe never will be) supported
*/
public final function getCounter () {
* @throws UnsupportedOperationException This method is not (and maybe never will be) supported
*/
public final function getCounter () {
- throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getPointerInstance()), self::EXCEPTION_UNSPPORTED_OPERATION);
+ throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getBinaryFileInstance()), self::EXCEPTION_UNSPPORTED_OPERATION);
*/
public function writeData (int $seekPosition, string $data, bool $flushHeader = true) {
// Not supported
*/
public function writeData (int $seekPosition, string $data, bool $flushHeader = true) {
// Not supported
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: seekPosition=%s,data[]=%s,flushHeader=%d', $seekPosition, gettype($data), intval($flushHeader)));
- throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getPointerInstance()), self::EXCEPTION_UNSPPORTED_OPERATION);
+ throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getBinaryFileInstance()), self::EXCEPTION_UNSPPORTED_OPERATION);
*/
public function writeAtPosition (int $seekPosition, string $dataStream) {
// Not supported
*/
public function writeAtPosition (int $seekPosition, string $dataStream) {
// Not supported
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: seekPosition=%d,dataStream(%d)=%s - CALLED!', $seekPosition, strlen($dataStream), $dataStream));
- throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getPointerInstance()), self::EXCEPTION_UNSPPORTED_OPERATION);
+ throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getBinaryFileInstance()), self::EXCEPTION_UNSPPORTED_OPERATION);
* @throws UnsupportedOperationException This method is not (and maybe never will be) supported
*/
public function writeValueToFile (string $stackName, $value) {
* @throws UnsupportedOperationException This method is not (and maybe never will be) supported
*/
public function writeValueToFile (string $stackName, $value) {
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: stackName=%s,value[%s]=%s', $stackName, gettype($value), print_r($value, true)));
- throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getPointerInstance()), self::EXCEPTION_UNSPPORTED_OPERATION);
+ throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getBinaryFileInstance()), self::EXCEPTION_UNSPPORTED_OPERATION);
*/
public function searchNextGap (int $length) {
// Not supported here
*/
public function searchNextGap (int $length) {
// Not supported here
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: length=%d - CALLED!', $length));
- throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getPointerInstance()), self::EXCEPTION_UNSPPORTED_OPERATION);
+ throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getBinaryFileInstance()), self::EXCEPTION_UNSPPORTED_OPERATION);
public function getFileSize () {
// Call iterator's method
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FILE-STACK: CALLED!');
public function getFileSize () {
// Call iterator's method
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FILE-STACK: CALLED!');
- $size = $this->getIteratorInstance()->getFileSize();
+ $size = $this->getIteratorInstance()->getBinaryFileInstance()->getFileSize();
// Return size
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: size=%d - EXIT!', $size));
// Return size
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: size=%d - EXIT!', $size));
// Search for next free gap
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: stackName=%s,hash=%s,rawData()=%d', $stackName, $hash, strlen($rawData)));
// Search for next free gap
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: stackName=%s,hash=%s,rawData()=%d', $stackName, $hash, strlen($rawData)));
- $gapPosition = $this->getIteratorInstance()->searchNextGap(strlen($rawData));
+ $gapPosition = $this->getIteratorInstance()->getBinaryFileInstance()->searchNextGap(strlen($rawData));
// Gap position cannot be smaller than header length + 1
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: gapPosition=%d', $gapPosition));
// Gap position cannot be smaller than header length + 1
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: gapPosition=%d', $gapPosition));
- if ($gapPosition <= $this->getIteratorInstance()->getHeaderSize()) {
+ if ($gapPosition <= $this->getIteratorInstance()->getBinaryFileInstance()->getHeaderSize()) {
// Improper gap position
throw new UnexpectedValueException(sprintf('gapPosition[%s]=%d is not larger than headerSize=%d',
gettype($gapPosition),
$gapPosition,
// Improper gap position
throw new UnexpectedValueException(sprintf('gapPosition[%s]=%d is not larger than headerSize=%d',
gettype($gapPosition),
$gapPosition,
- $this->getIteratorInstance()->getHeaderSize()
+ $this->getIteratorInstance()->getBinaryFileInstance()->getHeaderSize()
));
}
// Then write the data at that gap
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: stackName=%s,hash=%s,gapPosition=%s', $stackName, $hash, $gapPosition));
));
}
// Then write the data at that gap
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: stackName=%s,hash=%s,gapPosition=%s', $stackName, $hash, $gapPosition));
- $this->getIteratorInstance()->writeData($gapPosition, $rawData);
+ $this->getIteratorInstance()->getBinaryFileInstance()->writeData($gapPosition, $rawData);
// Return gap position, hash and length of raw data
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: stackName=%s,hash=%s,rawData()=%d - EXIT!', $stackName, $hash, strlen($rawData)));
// Return gap position, hash and length of raw data
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: stackName=%s,hash=%s,rawData()=%d - EXIT!', $stackName, $hash, strlen($rawData)));