blob: 53a33c8599f626790db7549b3fbecc1ab65760f9 [file] [log] [blame]
// Copyright 2017 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef _BSDIFF_COMPRESSOR_INTERFACE_H_
#define _BSDIFF_COMPRESSOR_INTERFACE_H_
#include <stddef.h>
#include <stdint.h>
#include <memory>
#include <vector>
#include "bsdiff/constants.h"
namespace bsdiff {
class CompressorInterface {
public:
virtual ~CompressorInterface() = default;
// Compress and write |size| bytes of input data starting from |buf|.
virtual bool Write(const uint8_t* buf, size_t size) = 0;
// Finish the compression step.
virtual bool Finish() = 0;
// Return the compressed data. This method must be only called after Finish().
virtual const std::vector<uint8_t>& GetCompressedData() = 0;
protected:
CompressorInterface() = default;
};
std::unique_ptr<CompressorInterface> CreateCompressor(CompressorType type);
} // namespace bsdiff
#endif // _BSDIFF_COMPRESSOR_INTERFACE_H_