aboutsummaryrefslogtreecommitdiffstats
path: root/emulator/qtools/decoder.h
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2009-03-03 19:29:09 -0800
committerThe Android Open Source Project <initial-contribution@android.com>2009-03-03 19:29:09 -0800
commit55a2c71f27d3e0b8344597c7f281e687cb7aeb1b (patch)
treeecd18b995aea8eeeb8b3823266280d41245bf0f7 /emulator/qtools/decoder.h
parent82ea7a177797b844b252effea5c7c7c5d63ea4ac (diff)
downloadsdk-55a2c71f27d3e0b8344597c7f281e687cb7aeb1b.zip
sdk-55a2c71f27d3e0b8344597c7f281e687cb7aeb1b.tar.gz
sdk-55a2c71f27d3e0b8344597c7f281e687cb7aeb1b.tar.bz2
auto import from //depot/cupcake/@135843
Diffstat (limited to 'emulator/qtools/decoder.h')
-rw-r--r--emulator/qtools/decoder.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/emulator/qtools/decoder.h b/emulator/qtools/decoder.h
new file mode 100644
index 0000000..44905fd
--- /dev/null
+++ b/emulator/qtools/decoder.h
@@ -0,0 +1,28 @@
+// Copyright 2006 The Android Open Source Project
+
+#include <stdio.h>
+#include <inttypes.h>
+
+class Decoder {
+ public:
+ Decoder();
+ ~Decoder();
+
+ void Open(char *filename);
+ void Close();
+ int64_t Decode(bool is_signed);
+ void Read(char *dest, int len);
+ bool IsEOF() { return (end_ == next_) && feof(fstream_); }
+
+ private:
+ static const int kBufSize = 4096;
+ static const int kDecodingSpace = 9;
+
+ void FillBuffer();
+
+ char *filename_;
+ FILE *fstream_;
+ uint8_t buf_[kBufSize];
+ uint8_t *next_;
+ uint8_t *end_;
+};