-
Notifications
You must be signed in to change notification settings - Fork 4
/
GzipFile.h
47 lines (32 loc) · 1.13 KB
/
GzipFile.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#ifndef GZIPFILE_H
#define GZIPFILE_H
#include "lzopfs.h"
#include "CompressedFile.h"
#include "GzipReader.h"
#include "FileList.h"
class GzipFile : public IndexedCompFile {
protected:
struct GzipBlock : public Block {
size_t bits;
Buffer dict;
GzipBlock(off_t uoff, off_t coff, size_t b)
: Block(0, 0, uoff, coff), bits(b) { }
};
void setLastBlockSize(off_t uoff, off_t coff);
Buffer& addBlock(off_t uoff, off_t coff, size_t bits);
virtual void checkFileType(FileHandle &fh);
virtual void buildIndex(FileHandle& fh);
virtual Block* newBlock() const { return new GzipBlock(0, 0, 0); }
virtual bool readBlock(FileHandle& fh, Block* b); // True unless EOF
virtual void writeBlock(FileHandle& fh, const Block *b) const;
public:
static const size_t WindowSize;
static CompressedFile* open(const std::string& path, const OpenParams& params)
{ return new GzipFile(path, params); }
size_t mBlockFactor;
GzipFile(const std::string& path, const OpenParams& params);
virtual std::string destName() const;
virtual void decompressBlock(const FileHandle& fh, const Block& b,
Buffer& ubuf) const;
};
#endif // GZIPFILE_H