Reader


Detailed Description

A framework to simplify file reading.

Reader is a hierarchy of classes that simplifies reading a file down to a few lines of code,
regardless or whether or not the file is compressed and whether it's read locally or over ftp, http, rssd, etc.

Most of the time users can get by with these code snippets:

Reading a file into a std::string:

 #include <wdssii/code_Reader.h>

 URL url = "http://www.wdsssii.org/index.html";
 std::string content;
 Reader :: read (url, content);
 std::cerr << "Read " << content.size() << " bytes from " << url << std::endl;

Reading a file into a code::Buffer:

 #include <wdssii/code_Reader.h>
 #include <wdssii/code_URL.h>

 URL url = "/tmp/somefile.txt.bz2";
 Buffer buf;
 Reader :: read (url, buf);
 std::cerr << "Read " << buf.size() << " bytes from " << url << std::endl;

Reading a file one line at a time:

 #include <wdssii/code_LineReader.h>
 #include <wdssii/code_URL.h>

 URL url = "/tmp/readme.gz";
 std::string line;
 SmartPtr<LineReader> lineReader = LineReader :: getLineReader (url);
 while (lineReader->readLine (line))
 {
   do_something_with_line (line);
 }

For other needs, see the Reader::read() and Reader::getReader functions().
To read from a file a chunk at a time, you can call Reader::getReader() and then loop calls to read(buf,0,chunksize).
To read the first N bytes of a file, you can call Reader::read(url,buf,0,N).

Version:
Id
code_Reader.h,v 1.26 2009/06/02 20:17:40 lakshman Exp
Author:
Charles Kerr


Classes

class  code::InMemoryReader
 Base class for Reader Decorators that load a URL's contents into a code::Buffer for massaging. More...
class  code::LineReader
 Reader Decorator which adds line-by-line reading. More...
class  code::LocalReader
 Reader for `file' (i.e., local) and `stdin' schemes. More...
class  code::Reader
 Simplifies file reading down to a few lines of code, regardless of whether or not the file is compressed and whether it's read locally or over ftp, http, rssd, etc. More...
class  code::SchemeReader
 Abstract Base Class for Readers that handle specific URL schemes such as http, ftp or rssd. More...
class  code::SchemeReaderCreator
 Abstract Base Class for classes that instantiate a SchemeReader. More...
class  code::WebReader
 Reader for `http' and `ftp' schemes that uses wget. More...
class  code::WebReaderCurlImpl
 Reader for `http' and `ftp' schemes that uses libcurl Tries to maintain connections with the server if the same URL is opened again, but does not cache server responses. More...
class  code::ZlibReader
 Reader Decorator which adds gz and bz2 uncompression. More...
class  code::ZReader
 Reader Decorator which adds .Z file uncompression. More...


Generated on Fri May 4 13:40:10 2012 for WDSS-IIw2 by  doxygen 1.4.7