From bb4c9b9f231b5443692659a6a7a81aa45a922286 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Mon, 23 Jun 2014 23:20:53 +0200 Subject: [PATCH] writeData() also belongs here. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../iterator/class_SeekableWritableFileIterator.php | 10 ++++++++++ .../binary/class_BaseBinaryFile.php | 2 +- .../main/iterator/file/class_FileIterator.php | 13 +++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/inc/classes/interfaces/iterator/class_SeekableWritableFileIterator.php b/inc/classes/interfaces/iterator/class_SeekableWritableFileIterator.php index 12df16c8..7ed07331 100644 --- a/inc/classes/interfaces/iterator/class_SeekableWritableFileIterator.php +++ b/inc/classes/interfaces/iterator/class_SeekableWritableFileIterator.php @@ -137,6 +137,16 @@ interface SeekableWritableFileIterator extends SeekableIterator { * @return $fileSize Size of currently loaded file */ function getFileSize (); + + /** + * Writes data at given position + * + * @param $seekPosition Seek position + * @param $data Data to be written + * @param $flushHeader Whether to flush the header (default: flush) + * @return void + */ + function writeData ($seekPosition, $data, $flushHeader = TRUE); } // [EOF] diff --git a/inc/classes/main/file_directories/binary/class_BaseBinaryFile.php b/inc/classes/main/file_directories/binary/class_BaseBinaryFile.php index 77b18e8e..4c46dca0 100644 --- a/inc/classes/main/file_directories/binary/class_BaseBinaryFile.php +++ b/inc/classes/main/file_directories/binary/class_BaseBinaryFile.php @@ -390,7 +390,7 @@ class BaseBinaryFile extends BaseFile { * @param $flushHeader Whether to flush the header (default: flush) * @return void */ - protected function writeData ($seekPosition, $data, $flushHeader = TRUE) { + public function writeData ($seekPosition, $data, $flushHeader = TRUE) { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] seekPosition=%s,data()=%s - CALLED!', __METHOD__, __LINE__, $seekPosition, strlen($data))); // Write data at given position diff --git a/inc/classes/main/iterator/file/class_FileIterator.php b/inc/classes/main/iterator/file/class_FileIterator.php index f8fadbde..e0c4b3dc 100644 --- a/inc/classes/main/iterator/file/class_FileIterator.php +++ b/inc/classes/main/iterator/file/class_FileIterator.php @@ -263,6 +263,19 @@ class FileIterator extends BaseIterator implements SeekableWritableFileIterator // Call block instance return $this->getBlockInstance()->getFileSize(); } + + /** + * Writes data at given position + * + * @param $seekPosition Seek position + * @param $data Data to be written + * @param $flushHeader Whether to flush the header (default: flush) + * @return void + */ + public function writeData ($seekPosition, $data, $flushHeader = TRUE) { + // Call block instance + $this->getBlockInstance()->writeData($seekPosition, $data, $flushHeader); + } } // [EOF] -- 2.39.5