X-Git-Url: https://git.mxchange.org/?p=core.git;a=blobdiff_plain;f=inc%2Fclasses%2Fmain%2Ffile_directories%2Findex%2Fclass_IndexFile.php;fp=inc%2Fclasses%2Fmain%2Ffile_directories%2Findex%2Fclass_IndexFile.php;h=c65bed4d3757dc3a4a911a7b9a0652e2ff4173dc;hp=2859fd84a0256e8eb7e1d748bd158ae492a3ee81;hb=6b19898fa5c1cc332e83100ea41f55073ec20a8a;hpb=f2e5c734f1b1397a95d517094152da14b136b5a1 diff --git a/inc/classes/main/file_directories/index/class_IndexFile.php b/inc/classes/main/file_directories/index/class_IndexFile.php index 2859fd84..c65bed4d 100644 --- a/inc/classes/main/file_directories/index/class_IndexFile.php +++ b/inc/classes/main/file_directories/index/class_IndexFile.php @@ -21,7 +21,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class IndexFile extends BaseFile implements SeekableWritableFileIterator { +class IndexFile extends BaseFile implements InputOutputPointer { /** * Protected constructor * @@ -35,15 +35,97 @@ class IndexFile extends BaseFile implements SeekableWritableFileIterator { /** * Creates an instance of this File class and prepares it for usage * + * @param $fileName Name of the index file * @return $fileInstance An instance of this File class */ - public final static function createIndexFile () { + public final static function createIndexFile ($fileName) { // Get a new instance $fileInstance = new IndexFile(); + // 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]