FileInputStream.h

Go to the documentation of this file.
00001 #ifndef FILE_INPUT_STREAM_H
00002 #define FILE_INPUT_STREAM_H
00003 
00004 #include <string>
00005 #include <fstream>
00006 #include "InputStream.h"
00007 
00008 //!@ingroup io
00009 //!Handles loading files from the local filesystem
00010 class FileInputStream : public InputStream
00011 {
00012 public:
00013     FileInputStream(const std::string & url);
00014     virtual ~FileInputStream();
00015 
00016     virtual char Peek();
00017     virtual char Read();
00018     virtual void Close();
00019 
00020     virtual bool IsOpen() const;
00021     virtual bool IsDone() const;
00022     virtual std::string GetLocation() const
00023     {
00024         return "file:"+fileName;
00025     }
00026 
00027 private:
00028     std::string fileName;
00029     std::ifstream file;
00030     off_t fileSize;
00031     off_t numRead;
00032 
00033     void ParseURL(const std::string & url);
00034     void OpenFile();
00035 };
00036 
00037 
00038 #endif

Generated on Wed Jul 7 16:30:27 2010 for CS240Utils by  doxygen 1.5.8