The Android Open Source Project | 52d4c30 | 2009-03-03 19:29:09 -0800 | [diff] [blame^] | 1 | // Copyright 2006 The Android Open Source Project |
| 2 | |
| 3 | #include <stdio.h> |
| 4 | #include <inttypes.h> |
| 5 | |
| 6 | class 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 | }; |