Continued CSV parsing:
[core.git] / inc / classes / main / file_directories / binary / class_BaseBinaryFile.php
index 77b18e8eed421c7e575ce73dc1581bb76df5869e..207f797d8b80a716dc59a52e1608aa3fe2815882 100644 (file)
@@ -4,7 +4,7 @@
  *
  * @author             Roland Haeder <webmaster@ship-simu.org>
  * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Core Developer Team
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2014 Core Developer Team
  * @license            GNU GPL 3.0 or any newer version
  * @link               http://www.ship-simu.org
  *
@@ -225,7 +225,7 @@ class BaseBinaryFile extends BaseFile {
         *
         * @return      $seekPosition   Current seek position (stored here in object)
         */
-       protected final function getSeekPosition () {
+       public final function getSeekPosition () {
                // Get it
                return $this->seekPosition;
        }
@@ -280,7 +280,7 @@ class BaseBinaryFile extends BaseFile {
                // ... to write it back into the file
                $this->flushFileHeader();
 
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] EXIT!!', __METHOD__, __LINE__));
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] EXIT!', __METHOD__, __LINE__));
        }
 
        /**
@@ -294,7 +294,7 @@ class BaseBinaryFile extends BaseFile {
                // Seek to currently ("old") saved position
                $this->seek($this->getSeekPosition());
 
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] EXIT!!', __METHOD__, __LINE__));
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] EXIT!', __METHOD__, __LINE__));
        }
 
        /**
@@ -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
@@ -506,7 +506,7 @@ class BaseBinaryFile extends BaseFile {
                // Rewind seek position (to beginning of file) and update/flush file header
                $this->rewindUpdateSeekPosition();
 
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] EXIT!!', __METHOD__, __LINE__));
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] EXIT!', __METHOD__, __LINE__));
        }
 
        /**
@@ -575,7 +575,10 @@ class BaseBinaryFile extends BaseFile {
         * @param       $bytes  Amount of bytes to read
         * @return      $data   Data read from file
         */
-       public function read ($bytes) {
+       public function read ($bytes = NULL) {
+               // $bytes shall be integer
+               assert(is_int($bytes));
+
                // Call pointer instance
                return $this->getPointerInstance()->read($bytes);
        }