* @version 0.0.0 * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2020 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 . */ interface FileIndexer extends Indexable { /** * Adds given data's hash to the index file * * @param $stackName Name of stack to add hash * @param $data Hash and gap position to be added to the index * @return void * @throws InvalidArgumentException If a parameter is not valid */ function addHashedDataToIndex (string $stackName, array $data); /** * Searches for next suitable gap the given length of data can fit in * including padding bytes. * * @param $length Length of raw data * @return $seekPosition Found next gap's seek position * @throws InvalidArgumentException If the parameter is not valid */ function searchNextGap (int $length); /** * Writes at given position by seeking to it. * * @param $seekPosition Seek position in file * @param $dataStream Data to be written * @return mixed Number of writes bytes or false on error * @throws InvalidArgumentException If a parameter is not valid */ function writeAtPosition (int $seekPosition, string $dataStream); }