Mercurial > hg > orthanc
diff 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 |
line wrap: on
line diff
--- a/OrthancFramework/Sources/FileStorage/FilesystemStorage.cpp Thu Feb 04 15:31:00 2021 +0100 +++ b/OrthancFramework/Sources/FileStorage/FilesystemStorage.cpp Thu Feb 04 18:01:07 2021 +0100 @@ -164,6 +164,22 @@ } + IMemoryBuffer* FilesystemStorage::ReadRange(const std::string& uuid, + FileContentType type, + uint64_t start /* inclusive */, + uint64_t end /* exclusive */) + { + LOG(INFO) << "Reading attachment \"" << uuid << "\" of \"" << GetDescriptionInternal(type) + << "\" content type (range from " << start << " to " << end << ")"; + + std::string content; + SystemToolbox::ReadFileRange( + content, GetPath(uuid).string(), start, end, true /* throw if overflow */); + + return StringMemoryBuffer::CreateFromSwap(content); + } + + uintmax_t FilesystemStorage::GetSize(const std::string& uuid) const { boost::filesystem::path path = GetPath(uuid);