fawkes::DynamicFileWebReply Class Reference

Dynamic raw file transfer reply. More...

#include <webview/file_reply.h>

Inheritance diagram for fawkes::DynamicFileWebReply:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 DynamicFileWebReply (const char *filename)
 Constructor.
virtual ~DynamicFileWebReply ()
 Destructor.
virtual size_t size ()
 Total size of the web reply.
virtual size_t next_chunk (size_t pos, char *buffer, size_t buf_max_size)
 Get data of next chunk.

Detailed Description

Dynamic raw file transfer reply.

This dynamic file transfer reply transmits the given file with a mime type determined with libmagic.

Author:
Tim Niemueller

Definition at line 34 of file file_reply.h.


Constructor & Destructor Documentation

fawkes::DynamicFileWebReply::DynamicFileWebReply ( const char *  filename  ) 

Constructor.

Parameters:
filename path and name of the file to transmit

Definition at line 46 of file file_reply.cpp.

References fawkes::WebReply::add_header(), and fawkes::mimetype_file().

fawkes::DynamicFileWebReply::~DynamicFileWebReply (  )  [virtual]

Destructor.

Definition at line 65 of file file_reply.cpp.


Member Function Documentation

size_t fawkes::DynamicFileWebReply::next_chunk ( size_t  pos,
char *  buffer,
size_t  buf_max_size 
) [virtual]

Get data of next chunk.

Parameters:
pos position in the stream. Note that a certain position may be called several times.
buffer buffer to store data in
buf_max_size maximum size in bytes of data that can be put into buffer
Returns:
number of bytes written to buffer, or -1 to immediately stop the transfer.

Implements fawkes::DynamicWebReply.

Definition at line 77 of file file_reply.cpp.

size_t fawkes::DynamicFileWebReply::size (  )  [virtual]

Total size of the web reply.

Return the total size of the reply if known, or 0 if it is not known. In the latter case your next_chunk() method has to return -1 at some point to end the transfer. If possible by any means return a meaningful value, as it will improve the experience of users, especially for long transfers!

Returns:
total size of reply in bytes

Implements fawkes::DynamicWebReply.

Definition at line 71 of file file_reply.cpp.


The documentation for this class was generated from the following files:

Generated on 1 Mar 2011 for Fawkes API by  doxygen 1.6.1