use Org\Mxchange\CoreFramework\Generic\UnsupportedOperationException;
use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
+// Import SPL stuff
+use \SplFileInfo;
+
/**
* A class for reading text files
*
* @author Roland Haeder <webmaster@shipsimu.org>
* @version 0.0.0
-<<<<<<< HEAD:framework/main/classes/file_directories/input/text/class_FrameworkTextFileInputPointer.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/input/text/class_FrameworkTextFileInputPointer.php
* @license GNU GPL 3.0 or any newer version
* @link http://www.shipsimu.org
*
* @throws FileReadProtectedException If the file cannot be read from
* @return void
*/
- public static final function createFrameworkTextFileInputPointer ($infoInstance) {
+ public static final function createFrameworkTextFileInputPointer (SplFileInfo $infoInstance) {
+ // Check parameter
if (!FrameworkBootstrap::isReachableFilePath($infoInstance)) {
// File cannot be reached
throw new FileIoException($infoInstance, self::EXCEPTION_FILE_NOT_REACHABLE);
// Try to open a handler
$fileObject = $infoInstance->openFile('r');
+
+ // Debug message
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TEXT-FILE-INPUT: fileObject[]=' . gettype($fileObject));
+
+ // Is it valid?
if ((is_null($fileObject)) || ($fileObject === false)) {
// Something bad happend
throw new FileIoException($infoInstance, self::EXCEPTION_FILE_POINTER_INVALID);
$pointerInstance = new FrameworkTextFileInputPointer();
// Set file pointer and file name
- $pointerInstance->setPointer($fileObject);
+ $pointerInstance->setFileObject($fileObject);
// Return the instance
return $pointerInstance;
*
* @param $bytes Amount of bytes to read or whole line (only text files)
* @return $data Data read from file
- * @throws NullPointerException If the file pointer instance is not set by setPointer()
+ * @throws NullPointerException If the file pointer instance is not set by setFileObject()
* @throws InvalidResourceException If there is no object being set
*/
public function read ($bytes = NULL) {