Inflater.h 789 Bytes
Newer Older
daFischer's avatar
first  
daFischer committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
/* 
 * File:   Inflater.h
 * Author: user
 *
 * Created on May 8, 2014, 12:46 PM
 */

#ifndef INFLATER_H
#define	INFLATER_H

#include <stdio.h>
#include <string>
#include <fstream>
#include <zlib.h>
#include <assert.h>
#include "SizedArray.h"

using namespace std;

#define CHUNK 16384

class Inflater {
public:
daFischer's avatar
daFischer committed
24
    Inflater(FILE* f);
daFischer's avatar
first  
daFischer committed
25 26 27
    ~Inflater();
    bool readByte(char* Byte);
    bool readSizedArray(SizedArray* sArray);
daFischer's avatar
daFischer committed
28
    char* readCharArray(int length, bool end);
daFischer's avatar
first  
daFischer committed
29 30 31
    bool readShort(short* s);
    bool readInt(int* s);
    bool readLong(long* s);
daFischer's avatar
daFischer committed
32
    bool skipBytes(int number);
daFischer's avatar
first  
daFischer committed
33 34 35
    bool endOfFile();
    
private:
daFischer's avatar
daFischer committed
36
    FILE* source;
daFischer's avatar
first  
daFischer committed
37 38 39 40 41 42 43 44 45 46
    unsigned char in[CHUNK];
    unsigned char out[CHUNK];
    int outOffset;
    int ret;
    z_stream strm;
    
};

#endif	/* INFLATER_H */