X-Git-Url: https://git.mxchange.org/?p=core.git;a=blobdiff_plain;f=framework%2Fmain%2Fclasses%2Ffile_directories%2Fio_stream%2Fclass_FileIoStream.php;h=25919e34720712b53086ac4bd12b86ad86c16747;hp=51406cbea3bafa2399c0d2131dae505caba3aa9e;hb=b9bfbe86c031c9d83c3670602906df191a33ba2a;hpb=5da8f717122568335b8a8ab230fa0de17e983fab diff --git a/framework/main/classes/file_directories/io_stream/class_FileIoStream.php b/framework/main/classes/file_directories/io_stream/class_FileIoStream.php index 51406cbe..25919e34 100644 --- a/framework/main/classes/file_directories/io_stream/class_FileIoStream.php +++ b/framework/main/classes/file_directories/io_stream/class_FileIoStream.php @@ -11,6 +11,9 @@ use CoreFramework\Object\BaseFrameworkSystem; use CoreFramework\Stream\Filesystem\FileInputStreamer; use CoreFramework\Stream\Filesystem\FileOutputStreamer; +// Import SPL stuff +use \SplFileInfo; + /** * An universal class for file input/output streams. * @@ -79,13 +82,13 @@ class FileIoStream extends BaseFrameworkSystem implements FileInputStreamer, Fil /** * Saves data to a given local file and create missing directory structures * - * @param $fileName The file name for the to be saved file + * @param $fileInstance 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 $fileInstance, array $dataArray) { // Try it five times $dirName = ''; $fileInstance = NULL; @@ -93,7 +96,7 @@ class FileIoStream extends BaseFrameworkSystem implements FileInputStreamer, Fil 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($fileInstance, 'wb')); } catch (FileNotFoundException $e) { // Bail out ApplicationEntryPoint::exitApplication('The application has made a fatal error. Exception: ' . $e->__toString() . ' with message: ' . $e->getMessage()); @@ -142,11 +145,11 @@ class FileIoStream extends BaseFrameworkSystem implements FileInputStreamer, Fil /** * 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 = ''; @@ -155,7 +158,7 @@ class FileIoStream extends BaseFrameworkSystem implements FileInputStreamer, Fil $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()) {