comparison OrthancFramework/Sources/FileStorage/FilesystemStorage.cpp @ 4495:fa2311f94d9f

IStorageArea::ReadRange()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 04 Feb 2021 18:01:07 +0100
parents 64f06e7d5fc7
children cff7fdfc83a4
comparison
equal deleted inserted replaced
4494:39192eb9b43d 4495:fa2311f94d9f
157 LOG(INFO) << "Reading attachment \"" << uuid << "\" of \"" << GetDescriptionInternal(type) 157 LOG(INFO) << "Reading attachment \"" << uuid << "\" of \"" << GetDescriptionInternal(type)
158 << "\" content type"; 158 << "\" content type";
159 159
160 std::string content; 160 std::string content;
161 SystemToolbox::ReadFile(content, GetPath(uuid).string()); 161 SystemToolbox::ReadFile(content, GetPath(uuid).string());
162
163 return StringMemoryBuffer::CreateFromSwap(content);
164 }
165
166
167 IMemoryBuffer* FilesystemStorage::ReadRange(const std::string& uuid,
168 FileContentType type,
169 uint64_t start /* inclusive */,
170 uint64_t end /* exclusive */)
171 {
172 LOG(INFO) << "Reading attachment \"" << uuid << "\" of \"" << GetDescriptionInternal(type)
173 << "\" content type (range from " << start << " to " << end << ")";
174
175 std::string content;
176 SystemToolbox::ReadFileRange(
177 content, GetPath(uuid).string(), start, end, true /* throw if overflow */);
162 178
163 return StringMemoryBuffer::CreateFromSwap(content); 179 return StringMemoryBuffer::CreateFromSwap(content);
164 } 180 }
165 181
166 182