Parolin 0.7.9 6796
Console (soon DLLs) to do a tar like job
Loading...
Searching...
No Matches
SkippableFrame.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2016-present, Facebook, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under both the BSD-style license (found in the
6 * LICENSE file in the root directory of this source tree) and the GPLv2 (found
7 * in the COPYING file in the root directory of this source tree).
8 */
9#pragma once
10
11#include "utils/Range.h"
12
13#include <array>
14#include <cstddef>
15#include <cstdint>
16#include <cstdio>
17
18namespace pzstd {
37class SkippableFrame {
38 public:
39 static constexpr std::size_t kSize = 12;
40
41 private:
42 std::uint32_t frameSize_;
43 std::array<std::uint8_t, kSize> data_;
44 static constexpr std::uint32_t kSkippableFrameMagicNumber = 0x184D2A50;
45 // Could be improved if the size fits in less bytes
46 static constexpr std::uint32_t kFrameContentsSize = kSize - 8;
47
48 public:
49 // Write the skippable frame to data_ in LE format.
50 explicit SkippableFrame(std::uint32_t size);
51
52 // Read the skippable frame from bytes in LE format.
53 static std::size_t tryRead(ByteRange bytes);
54
55 ByteRange data() const {
56 return {data_.data(), data_.size()};
57 }
58
59 // Size of the next frame.
60 std::size_t frameSize() const {
61 return frameSize_;
62 }
63};
64}
Definition Range.h:50
ByteRange data() const
Definition SkippableFrame.h:55
static std::size_t tryRead(ByteRange bytes)
Definition SkippableFrame.cpp:23
SkippableFrame(std::uint32_t size)
Definition SkippableFrame.cpp:17
std::size_t frameSize() const
Definition SkippableFrame.h:60
static constexpr std::size_t kSize
Definition SkippableFrame.h:39
Definition ErrorHolder.h:16
Definition compress42.c:551
size_t size
Definition platform.h:559