<?php
// Own namespace
-namespace CoreFramework\Stream\Filesystem;
+namespace Org\Mxchange\CoreFramework\Stream\Filesystem;
// Import framework stuff
-use CoreFramework\Factory\ObjectFactory;
-use CoreFramework\Filesystem\FileNotFoundException;
-use CoreFramework\Generic\UnsupportedOperationException;
-use CoreFramework\Object\BaseFrameworkSystem;
-use CoreFramework\Stream\Filesystem\FileInputStreamer;
-use CoreFramework\Stream\Filesystem\FileOutputStreamer;
+use Org\Mxchange\CoreFramework\EntryPoint\ApplicationEntryPoint;
+use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
+use Org\Mxchange\CoreFramework\Filesystem\FileNotFoundException;
+use Org\Mxchange\CoreFramework\Generic\UnsupportedOperationException;
+use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
+use Org\Mxchange\CoreFramework\Stream\Filesystem\FileInputStreamer;
+use Org\Mxchange\CoreFramework\Stream\Filesystem\FileOutputStreamer;
+
+// Import SPL stuff
+use \SplFileInfo;
/**
* An universal class for file input/output streams.
*
* @author Roland Haeder <webmaster@shipsimu.org>
* @version 0.0.0
+<<<<<<< HEAD:framework/main/classes/file_directories/io_stream/class_FileIoStream.php
* @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team
+=======
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2016 Core Developer Team
+>>>>>>> Some updates::inc/main/classes/file_directories/io_stream/class_FileIoStream.php
* @license GNU GPL 3.0 or any newer version
* @link http://www.shipsimu.org
*
/**
* Saves data to a given local file and create missing directory structures
*
- * @param $fileName The file name for the to be saved file
+ * @param $fileInfoInstance An instance of a SplFileInfo class
* @param $dataArray The data we shall store to the file
* @return void
* @see FileOutputStreamer
* @todo This method needs heavy rewrite
*/
- public final function saveFile ($fileName, array $dataArray) {
+ public final function saveFile (SplFileInfo $fileInfoInstance, array $dataArray) {
// Try it five times
$dirName = '';
$fileInstance = NULL;
for ($idx = 0; $idx < 5; $idx++) {
// Get a file output pointer
try {
- $fileInstance = ObjectFactory::createObjectByConfiguredName('file_raw_output_class', array($fileName, 'wb'));
+ $fileInstance = ObjectFactory::createObjectByConfiguredName('file_raw_output_class', array($fileInfoInstance, 'wb'));
} catch (FileNotFoundException $e) {
// Bail out
- ApplicationEntryPoint::app_exit('The application has made a fatal error. Exception: ' . $e->__toString() . ' with message: ' . $e->getMessage());
+ ApplicationEntryPoint::exitApplication('The application has made a fatal error. Exception: ' . $e->__toString() . ' with message: ' . $e->getMessage());
}
} // END - for
/**
* Reads from a local file
*
- * @param $fqfn The full-qualified file-name which we shall load
+ * @param $infoInstance An instance of a SplFileInfo class
* @return $array An array with the element 'header' and 'data'
* @see FileInputStreamer
*/
- public final function loadFileContents ($fqfn) {
+ public final function loadFileContents (SplFileInfo $infoInstance) {
// Initialize some variables and arrays
$inputBuffer = '';
$lastBuffer = '';
$readData = ''; // This will contain our read data
// Get a file input handler
- $fileInstance = ObjectFactory::createObjectByConfiguredName('file_raw_input_class', array($fqfn));
+ $fileInstance = ObjectFactory::createObjectByConfiguredName('file_raw_input_class', array($infoInstance));
// Read all it's contents (we very and transparently decompress it below)
while ($readRawLine = $fileInstance->readFromFile()) {