Mercurial > hg > orthanc
annotate OrthancFramework/Sources/Compression/ZipWriter.h @ 4934:94a7b681b340 more-tags
added configuration for extra main dicom tags + save signature in metadata + show warning if inconsistent main dicom tags
author | Alain Mazy <am@osimis.io> |
---|---|
date | Thu, 10 Mar 2022 09:03:24 +0100 |
parents | 43e613a7756b |
children | 0ea402b4d901 |
rev | line source |
---|---|
136 | 1 /** |
2 * Orthanc - A Lightweight, RESTful DICOM Store | |
1900 | 3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
1288
6e7e5ed91c2d
upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1277
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
4870
43e613a7756b
upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4831
diff
changeset
|
5 * Copyright (C) 2017-2022 Osimis S.A., Belgium |
43e613a7756b
upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4831
diff
changeset
|
6 * Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
136 | 7 * |
8 * This program is free software: you can redistribute it and/or | |
4119
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
9 * modify it under the terms of the GNU Lesser General Public License |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
10 * as published by the Free Software Foundation, either version 3 of |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
11 * the License, or (at your option) any later version. |
136 | 12 * |
13 * This program is distributed in the hope that it will be useful, but | |
14 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
4119
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
16 * Lesser General Public License for more details. |
136 | 17 * |
4119
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
18 * You should have received a copy of the GNU Lesser General Public |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
19 * License along with this program. If not, see |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
20 * <http://www.gnu.org/licenses/>. |
136 | 21 **/ |
22 | |
23 | |
81 | 24 #pragma once |
25 | |
3992
f9863630ec7f
working on the shared library for Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3945
diff
changeset
|
26 #include "../OrthancFramework.h" |
f9863630ec7f
working on the shared library for Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3945
diff
changeset
|
27 |
2508
91ee08d986f9
possibility to disable zlib support in the Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
28 #if !defined(ORTHANC_ENABLE_ZLIB) |
91ee08d986f9
possibility to disable zlib support in the Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
29 # error The macro ORTHANC_ENABLE_ZLIB must be defined |
91ee08d986f9
possibility to disable zlib support in the Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
30 #endif |
91ee08d986f9
possibility to disable zlib support in the Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
31 |
91ee08d986f9
possibility to disable zlib support in the Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
32 #if ORTHANC_ENABLE_ZLIB != 1 |
91ee08d986f9
possibility to disable zlib support in the Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
33 # error ZLIB support must be enabled to include this file |
91ee08d986f9
possibility to disable zlib support in the Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
34 #endif |
91ee08d986f9
possibility to disable zlib support in the Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
35 |
4670
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
36 #if ORTHANC_BUILD_UNIT_TESTS == 1 |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
37 # include <gtest/gtest_prod.h> |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
38 #endif |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
39 |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
40 #include "../ChunkedBuffer.h" |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
41 #include "../Compatibility.h" |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
42 |
2508
91ee08d986f9
possibility to disable zlib support in the Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
43 |
81 | 44 #include <stdint.h> |
93 | 45 #include <string> |
3992
f9863630ec7f
working on the shared library for Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3945
diff
changeset
|
46 #include <boost/noncopyable.hpp> |
81 | 47 #include <boost/shared_ptr.hpp> |
265 | 48 |
81 | 49 namespace Orthanc |
50 { | |
3992
f9863630ec7f
working on the shared library for Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3945
diff
changeset
|
51 class ORTHANC_PUBLIC ZipWriter : public boost::noncopyable |
81 | 52 { |
4670
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
53 #if ORTHANC_BUILD_UNIT_TESTS == 1 |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
54 FRIEND_TEST(ZipWriter, BufferWithSeek); |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
55 #endif |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
56 |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
57 public: |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
58 // New in Orthanc 1.9.4 |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
59 class ORTHANC_PUBLIC IOutputStream : public boost::noncopyable |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
60 { |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
61 public: |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
62 virtual ~IOutputStream() |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
63 { |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
64 } |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
65 |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
66 virtual void Write(const std::string& chunk) = 0; |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
67 |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
68 virtual void Close() = 0; |
4672
d9942d48fea7
ZipWriter::CancelStream(), ZipWriter::GetArchiveSize() and HttpOutput::AnswerWithoutBuffering()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4670
diff
changeset
|
69 |
d9942d48fea7
ZipWriter::CancelStream(), ZipWriter::GetArchiveSize() and HttpOutput::AnswerWithoutBuffering()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4670
diff
changeset
|
70 virtual uint64_t GetArchiveSize() const = 0; |
4670
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
71 }; |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
72 |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
73 |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
74 // The lifetime of the "target" buffer must be larger than that of ZipWriter |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
75 class ORTHANC_PUBLIC MemoryStream : public IOutputStream |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
76 { |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
77 private: |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
78 std::string& target_; |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
79 ChunkedBuffer chunked_; |
4672
d9942d48fea7
ZipWriter::CancelStream(), ZipWriter::GetArchiveSize() and HttpOutput::AnswerWithoutBuffering()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4670
diff
changeset
|
80 uint64_t archiveSize_; |
4670
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
81 |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
82 public: |
4690 | 83 explicit MemoryStream(std::string& target); |
4670
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
84 |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
85 virtual void Write(const std::string& chunk) ORTHANC_OVERRIDE; |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
86 |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
87 virtual void Close() ORTHANC_OVERRIDE; |
4672
d9942d48fea7
ZipWriter::CancelStream(), ZipWriter::GetArchiveSize() and HttpOutput::AnswerWithoutBuffering()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4670
diff
changeset
|
88 |
d9942d48fea7
ZipWriter::CancelStream(), ZipWriter::GetArchiveSize() and HttpOutput::AnswerWithoutBuffering()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4670
diff
changeset
|
89 virtual uint64_t GetArchiveSize() const ORTHANC_OVERRIDE; |
4670
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
90 }; |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
91 |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
92 |
81 | 93 private: |
4670
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
94 // This class is only public for unit tests |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
95 class ORTHANC_PUBLIC BufferWithSeek : public boost::noncopyable |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
96 { |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
97 private: |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
98 size_t currentPosition_; |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
99 ChunkedBuffer chunks_; |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
100 std::string flattened_; |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
101 |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
102 void CheckInvariants() const; |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
103 |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
104 public: |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
105 BufferWithSeek(); |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
106 |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
107 ~BufferWithSeek(); |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
108 |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
109 size_t GetPosition() const; |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
110 |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
111 size_t GetSize() const; |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
112 |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
113 void Write(const void* data, |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
114 size_t size); |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
115 |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
116 void Write(const std::string& data); |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
117 |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
118 void Seek(size_t position); |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
119 |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
120 void Flush(std::string& target); |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
121 }; |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
122 |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
123 |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
124 private: |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
125 class StreamBuffer; |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
126 |
81 | 127 struct PImpl; |
128 boost::shared_ptr<PImpl> pimpl_; | |
129 | |
644
eb5a0b21d05e
do not use ZIP64 as the default format anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
130 bool isZip64_; |
81 | 131 bool hasFileInZip_; |
1277
46bca019587e
primitives to add new content to existing ZIP files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
689
diff
changeset
|
132 bool append_; |
81 | 133 uint8_t compressionLevel_; |
134 std::string path_; | |
135 | |
4670
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
136 std::unique_ptr<IOutputStream> outputStream_; |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
137 |
81 | 138 public: |
139 ZipWriter(); | |
140 | |
141 ~ZipWriter(); | |
142 | |
644
eb5a0b21d05e
do not use ZIP64 as the default format anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
143 void SetZip64(bool isZip64); |
eb5a0b21d05e
do not use ZIP64 as the default format anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
144 |
4296
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
145 bool IsZip64() const; |
644
eb5a0b21d05e
do not use ZIP64 as the default format anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
146 |
81 | 147 void SetCompressionLevel(uint8_t level); |
148 | |
4296
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
149 uint8_t GetCompressionLevel() const; |
1277
46bca019587e
primitives to add new content to existing ZIP files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
689
diff
changeset
|
150 |
46bca019587e
primitives to add new content to existing ZIP files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
689
diff
changeset
|
151 void SetAppendToExisting(bool append); |
46bca019587e
primitives to add new content to existing ZIP files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
689
diff
changeset
|
152 |
4296
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
153 bool IsAppendToExisting() const; |
81 | 154 |
155 void Open(); | |
156 | |
157 void Close(); | |
158 | |
159 bool IsOpen() const; | |
160 | |
161 void SetOutputPath(const char* path); | |
162 | |
4296
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
163 const std::string& GetOutputPath() const; |
81 | 164 |
249 | 165 void OpenFile(const char* path); |
81 | 166 |
3945
0b3256c3ee14
simplified IDicomTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
167 void Write(const void* data, size_t length); |
81 | 168 |
169 void Write(const std::string& data); | |
4670
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
170 |
4672
d9942d48fea7
ZipWriter::CancelStream(), ZipWriter::GetArchiveSize() and HttpOutput::AnswerWithoutBuffering()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4670
diff
changeset
|
171 void AcquireOutputStream(IOutputStream* stream, // transfers ownership |
d9942d48fea7
ZipWriter::CancelStream(), ZipWriter::GetArchiveSize() and HttpOutput::AnswerWithoutBuffering()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4670
diff
changeset
|
172 bool isZip64); |
4670
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
173 |
b12faca76a52
support of output streams in ZipWriter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
174 // The lifetime of the "target" buffer must be larger than that of ZipWriter |
4672
d9942d48fea7
ZipWriter::CancelStream(), ZipWriter::GetArchiveSize() and HttpOutput::AnswerWithoutBuffering()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4670
diff
changeset
|
175 void SetMemoryOutput(std::string& target, |
d9942d48fea7
ZipWriter::CancelStream(), ZipWriter::GetArchiveSize() and HttpOutput::AnswerWithoutBuffering()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4670
diff
changeset
|
176 bool isZip64); |
d9942d48fea7
ZipWriter::CancelStream(), ZipWriter::GetArchiveSize() and HttpOutput::AnswerWithoutBuffering()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4670
diff
changeset
|
177 |
d9942d48fea7
ZipWriter::CancelStream(), ZipWriter::GetArchiveSize() and HttpOutput::AnswerWithoutBuffering()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4670
diff
changeset
|
178 void CancelStream(); |
d9942d48fea7
ZipWriter::CancelStream(), ZipWriter::GetArchiveSize() and HttpOutput::AnswerWithoutBuffering()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4670
diff
changeset
|
179 |
d9942d48fea7
ZipWriter::CancelStream(), ZipWriter::GetArchiveSize() and HttpOutput::AnswerWithoutBuffering()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4670
diff
changeset
|
180 // WARNING: "GetArchiveSize()" only has its final value after |
d9942d48fea7
ZipWriter::CancelStream(), ZipWriter::GetArchiveSize() and HttpOutput::AnswerWithoutBuffering()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4670
diff
changeset
|
181 // "Close()" has been called |
d9942d48fea7
ZipWriter::CancelStream(), ZipWriter::GetArchiveSize() and HttpOutput::AnswerWithoutBuffering()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4670
diff
changeset
|
182 uint64_t GetArchiveSize() const; |
81 | 183 }; |
184 } |