blob: 44905fd51276c84db7b1ff0ba8765f1e6875285a [file] [log] [blame]
The Android Open Source Project52d4c302009-03-03 19:29:09 -08001// Copyright 2006 The Android Open Source Project
2
3#include <stdio.h>
4#include <inttypes.h>
5
6class Decoder {
7 public:
8 Decoder();
9 ~Decoder();
10
11 void Open(char *filename);
12 void Close();
13 int64_t Decode(bool is_signed);
14 void Read(char *dest, int len);
15 bool IsEOF() { return (end_ == next_) && feof(fstream_); }
16
17 private:
18 static const int kBufSize = 4096;
19 static const int kDecodingSpace = 9;
20
21 void FillBuffer();
22
23 char *filename_;
24 FILE *fstream_;
25 uint8_t buf_[kBufSize];
26 uint8_t *next_;
27 uint8_t *end_;
28};