public function getRecord($index) {
        if (!$this->isValid()) {
            throw new Exception('File is not opened', Exception::FILE_NOT_OPENED);
        }
        if (!$this->offsetExists($index)) {
            throw new Exception('Offset '.strval($index).' does not exists', Exception::INVALID_OFFSET);
        }
        if (isset($this->buffer[$index])) {
            return $this->buffer[$index];
        }
        $this->buffer = $this->getFormat()->getRecords($index, $this->getBufferSize());
        return $this->buffer[$index];
    }