/* */ #include "FallocFileAllocationIterator.h" #include "DlAbortEx.h" namespace aria2 { FallocFileAllocationIterator::FallocFileAllocationIterator (BinaryStream* stream, off_t offset, uint64_t totalLength): _stream(stream), _offset(offset), _totalLength(totalLength) {} void FallocFileAllocationIterator::allocateChunk() { if(static_cast(_offset) > _totalLength) { throw DL_ABORT_EX("FallocFileAllocationIterator: offset is larger than" " totalLength"); } _stream->allocate(_offset, _totalLength-_offset); _offset = _totalLength; } bool FallocFileAllocationIterator::finished() { return static_cast(_offset) == _totalLength; } off_t FallocFileAllocationIterator::getCurrentLength() { return _offset; } uint64_t FallocFileAllocationIterator::getTotalLength() { return _totalLength; } } // namespace aria2