1 /* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef DEFLATE_ADAPTER_H 17 #define DEFLATE_ADAPTER_H 18 #include <iostream> 19 #include "diffpatch.h" 20 21 namespace UpdatePatch { 22 class DeflateAdapter { 23 public: 24 static constexpr uint32_t BUFFER_SIZE = 1024 * 32; 25 DeflateAdapter() = default; ~DeflateAdapter()26 virtual ~DeflateAdapter() {} 27 Open()28 virtual int32_t Open() 29 { 30 return 0; 31 }; Close()32 virtual int32_t Close() 33 { 34 return 0; 35 }; WriteData(const BlockBuffer & srcData)36 virtual int32_t WriteData(const BlockBuffer &srcData) 37 { 38 return 0; 39 }; FlushData(size_t & offset)40 virtual int32_t FlushData(size_t &offset) 41 { 42 return 0; 43 }; 44 45 protected: 46 bool init_ = false; 47 }; 48 } // namespace UpdatePatch 49 #endif // DEFLATE_ADAPTER_H 50