00001
00006 #ifndef _BITSTREAM_H_
00007 #define _BITSTREAM_H_
00008
00009 #include <fstream>
00010
00024 class Bitstream
00025 {
00026 public:
00027
00029 enum { in,
00030 out
00031 };
00032
00040 Bitstream(const char *filename, int mode);
00041
00051 Bitstream(const char **files, int mode);
00052
00062 void Read(unsigned int *data, int numbits);
00063
00073 void Write(const unsigned int *data, int numbits);
00074
00080 void Seek(int numbits);
00081
00092 int Find(unsigned int pattern, int numbits);
00093
00105 void ReadBytes(char *bytes, int num);
00106
00116 void WriteBytes(const char *bytes, int num);
00117
00123 void WriteNullBytes(int num);
00124
00125 private:
00126 void Open(const char *filename);
00127 void CheckTag();
00128
00129 std::fstream m_stream;
00130 const char **m_files;
00131 int m_mode;
00132 int m_size;
00133 int m_leftbits;
00134 unsigned char m_char;
00135 static const char *m_NULL;
00136 };
00137
00138 #endif //_BITSTREAM_H_