Inflater.h 823 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 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
/* 
 * 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 <curl/curl.h>

#include "SizedArray.h"
#include "Downloader.h"

using namespace std;

#define CHUNK 16384

class Inflater {
public:
    Inflater(Downloader* d);
    ~Inflater();
    bool readByte(char* Byte);
    bool readSizedArray(SizedArray* sArray);
    bool readCharArray(char* ByteArray, int length);
    bool readShort(short* s);
    bool readInt(int* s);
    bool readLong(long* s);
    bool endOfFile();
    
private:
    Downloader* source;
    unsigned char in[CHUNK];
    unsigned char out[CHUNK];
    int outOffset;
    int ret;
    z_stream strm;
    
};

#endif	/* INFLATER_H */