* @version 0.0.0 * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Core Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ class StackFile extends BaseFile implements InputOutputPointer { /** * Protected constructor * * @return void */ protected function __construct () { // Call parent constructor parent::__construct(__CLASS__); } /** * Creates an instance of this File class and prepares it for usage * * @param $fileName Name of the stack file * @return $fileInstance An instance of this File class */ public final static function createStackFile ($fileName) { // Get a new instance $fileInstance = new StackFile(); // Init this abstract file $fileInstance->initFile($fileName); // Return the prepared instance return $fileInstance; } /** * Determines seek position * * @return $seekPosition Current seek position * @todo 0% done */ public final function determineSeekPosition () { $this->partialStub('Unfinished method.'); } /** * Seek to given offset (default) or other possibilities as fseek() gives. * * @param $offset Offset to seek to (or used as "base" for other seeks) * @param $whence Added to offset (default: only use offset to seek to) * @return $status Status of file seek: 0 = success, -1 = failed * @todo 0% done */ public function seek ($offset, $whence = SEEK_SET) { $this->partialStub('Unfinished method.'); } /** * Size of this file * * @return $size Size (in bytes) of file * @todo Handle seekStatus * @todo 0% done */ public function size () { $this->partialStub('Unfinished method.'); } /** * Read data a file pointer * * @return mixed The result of fread() * @throws NullPointerException If the file pointer instance * is not set by setPointer() * @throws InvalidResourceException If there is being set */ public function readFromFile () { $this->partialStub('Unfinished method.'); } /** * Reads given amount of bytes from file. * * @param $bytes Amount of bytes to read * @return $data Data read from file */ public function read ($bytes) { $this->partialStub('bytes=' . $bytes); } /** * Write data to a file pointer * * @param $dataStream The data stream we shall write to the file * @return mixed Number of writes bytes or FALSE on error * @throws NullPointerException If the file pointer instance * is not set by setPointer() * @throws InvalidResourceException If there is being set * an invalid file resource */ public function writeToFile ($dataStream) { $this->partialStub('dataStream=' . $dataStream); } /** * Rewinds to the beginning of the file * * @return $status Status of this operation */ public function rewind () { $this->partialStub('Unfinished method.'); } } // [EOF] ?>