libStatGen Software
1
Loading...
Searching...
No Matches
GzipHeader.h
1
/*
2
* Copyright (C) 2010 Regents of the University of Michigan
3
*
4
* This program is free software: you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation, either version 3 of the License, or
7
* (at your option) any later version.
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16
*/
17
18
#ifndef __GZIPHEADER_H__
19
#define __GZIPHEADER_H__
20
21
#include <stdint.h>
22
#include <stdio.h>
23
#include "UncompressedFileType.h"
24
25
class
GzipHeader
26
{
27
public
:
28
GzipHeader
();
29
~GzipHeader
();
30
31
// Method to read the gzip header from a file.
32
// Returns true if the file is a gzip file, false, otherwise.
33
bool
readHeader(FILE* filePtr);
34
35
// Method to read the gzip header from a file of UncompresedFileType.
36
// Returns true if the file is a gzip file, false, otherwise.
37
bool
readHeader(
UncompressedFileType
& file);
38
39
// Determine if the file is a gzip file.
40
bool
isGzipFile();
41
42
// Determine if the file is a BGZF compressed file.
43
bool
isBgzfFile();
44
45
private
:
46
47
static
const
unsigned
int
GZIP_HEADER_SIZE = 18;
48
49
union
50
{
51
struct
52
{
53
uint8_t id1;
54
uint8_t id2;
55
uint8_t cm;
56
uint8_t flg;
57
uint32_t mtime;
58
uint8_t xfl;
59
uint8_t os;
60
uint16_t xlen;
61
uint8_t si1;
62
uint8_t si2;
63
uint16_t slen;
64
uint16_t bsize;
65
};
66
char
headerBuffer[GzipHeader::GZIP_HEADER_SIZE];
67
};
68
char
buffer[GZIP_HEADER_SIZE];
69
70
};
71
72
73
#endif
GzipHeader
Definition
GzipHeader.h:26
UncompressedFileType
Definition
UncompressedFileType.h:27
general
GzipHeader.h
Generated by
1.9.8