X-Git-Url: https://git.mxchange.org/?p=core.git;a=blobdiff_plain;f=inc%2Fmain%2Fclasses%2Ffile_directories%2Fclass_BaseFileIo.php;h=829557eadb8866c1bbec63d7a25c068c46197da7;hp=d52d02fa1b00c7e6d5ef8c9caa0d5eed68ef3967;hb=7629f2314d517561d4301ddfb068a797b6ed8700;hpb=751f9e6c51f00dba27757b72fc85490e51fd3797 diff --git a/inc/main/classes/file_directories/class_BaseFileIo.php b/inc/main/classes/file_directories/class_BaseFileIo.php index d52d02fa..829557ea 100644 --- a/inc/main/classes/file_directories/class_BaseFileIo.php +++ b/inc/main/classes/file_directories/class_BaseFileIo.php @@ -1,10 +1,17 @@ * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Core Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * @@ -21,7 +28,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class BaseFileIo extends BaseFrameworkSystem { +class BaseFileIo extends BaseFrameworkSystem implements FilePointer, CloseableFile { /** * The current file we are working in */ @@ -67,9 +74,9 @@ class BaseFileIo extends BaseFrameworkSystem { * @throws NullPointerException If the file pointer instance is not set by setPointer() * @throws InvalidResourceException If there is being set */ - private function closeFile () { + public function closeFile () { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d]: fileName=%s - CALLED!', __METHOD__, __LINE__, $this->getFileName())); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d]: fileName=%s - CALLED!', __METHOD__, __LINE__, $this->getFileName())); if (is_null($this->getPointer())) { // Pointer not initialized @@ -80,7 +87,7 @@ class BaseFileIo extends BaseFrameworkSystem { } // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d]: Closing file %s ...', __METHOD__, __LINE__, $this->getFileName())); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d]: Closing file %s ...', __METHOD__, __LINE__, $this->getFileName())); // Close the file pointer and reset the instance variable @fclose($this->getPointer()); @@ -88,7 +95,7 @@ class BaseFileIo extends BaseFrameworkSystem { $this->setFileName(''); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d]: EXIT!', __METHOD__, __LINE__)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d]: EXIT!', __METHOD__, __LINE__)); } /** @@ -160,7 +167,7 @@ class BaseFileIo extends BaseFrameworkSystem { $status = fseek($this->getPointer(), $offset, $whence); // Return status - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] status=%d', __METHOD__, __LINE__, $status)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] status=%d', __METHOD__, __LINE__, $status)); return $status; } @@ -171,14 +178,14 @@ class BaseFileIo extends BaseFrameworkSystem { * @todo Handle seekStatus */ public function size () { - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] CALLED!', __METHOD__, __LINE__)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] CALLED!', __METHOD__, __LINE__)); // Get current seek position $seekPosition = $this->determineSeekPosition(); // Seek to end $seekStatus = $this->seek(0, SEEK_END); - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] seekStatus=%d', __METHOD__, __LINE__, $seekStatus)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] seekStatus=%d', __METHOD__, __LINE__, $seekStatus)); // Get position again (which is the end of the file) $size = $this->determineSeekPosition(); @@ -187,10 +194,8 @@ class BaseFileIo extends BaseFrameworkSystem { $this->seek($seekPosition); // Return size - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] size=%s - EXIT!', __METHOD__, __LINE__, $size)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] size=%s - EXIT!', __METHOD__, __LINE__, $size)); return $size; } -} -// [EOF] -?> +}