#include "FileRewindInputStream.hpp" #include using namespace std; FileRewindInputStream::FileRewindInputStream( const URL &url ) : RewindInputStream( url ), ifstream( ) { if( url.protocol( ) != "file" || url.host( ) != "localhost" ) { throw new runtime_error( "URL doesn't denote a local file" ); } open( url.path( ).c_str( ), ios::binary ); } FileRewindInputStream::~FileRewindInputStream( ) { close( ); } void FileRewindInputStream::rewind( ) { ifstream::clear( ); ifstream::seekg( 0, ios::beg ); } string FileRewindInputStream::lastErrMsg( ) const { // TODO: tricky to get OS-indepented error messages here return ""; }