Download NHK English news podcast automatically. This application requires mpod mother board. See also http://mbed.org/users/geodenx/notebook/mpod/

Dependencies:   BlinkLed HTTPClient EthernetInterface FatFileSystemCpp MSCFileSystem mbed-rtos mbed

Embed: (wiki syntax)

« Back to documentation index

HTTPFile Class Reference

A data endpoint to store file. More...

#include <HTTPFile.h>

Public Member Functions

 HTTPFile (const char *path)
 Create an HTTPFile instance for input.
void clear ()
 Forces file closure.

Protected Member Functions

virtual void readReset ()
 Reset stream to its beginning Called by the HTTPClient on each new request.
virtual int read (char *buf, size_t len, size_t *pReadLen)
 Read a piece of data to be transmitted.
virtual void writeReset ()
 Reset stream to its beginning Called by the HTTPClient on each new request.
virtual int write (const char *buf, size_t len)
 Write a piece of data transmitted by the server.
virtual int getDataType (char *type, size_t maxTypeLen)
 Get MIME type.
virtual void setDataType (const char *type)
 Set MIME type.
virtual bool getIsChunked ()
 Determine whether the HTTP client should chunk the data Used for Transfer-Encoding header.
virtual void setIsChunked (bool chunked)
 Determine whether the data is chunked Recovered from Transfer-Encoding header.
virtual size_t getDataLen ()
 If the data is not chunked, get its size Used for Content-Length header.
virtual void setDataLen (size_t len)
 If the data is not chunked, set its size From Content-Length header.

Detailed Description

A data endpoint to store file.

Definition at line 13 of file HTTPFile.h.


Constructor & Destructor Documentation

HTTPFile ( const char *  path )

Create an HTTPFile instance for input.

Parameters:
pathPath of file to store the incoming string

Definition at line 13 of file HTTPFile.cpp.


Member Function Documentation

void clear (  )

Forces file closure.

Definition at line 26 of file HTTPFile.cpp.

size_t getDataLen (  ) [protected, virtual]

If the data is not chunked, get its size Used for Content-Length header.

Definition at line 95 of file HTTPFile.cpp.

int getDataType ( char *  type,
size_t  maxTypeLen 
) [protected, virtual]

Get MIME type.

Parameters:
typeInternet media type from Content-Type header

Definition at line 73 of file HTTPFile.cpp.

bool getIsChunked (  ) [protected, virtual]

Determine whether the HTTP client should chunk the data Used for Transfer-Encoding header.

Definition at line 85 of file HTTPFile.cpp.

int read ( char *  buf,
size_t  len,
size_t *  pReadLen 
) [protected, virtual]

Read a piece of data to be transmitted.

Parameters:
bufPointer to the buffer on which to copy the data
lenLength of the buffer
pReadLenPointer to the variable on which the actual copied data length will be stored

Definition at line 38 of file HTTPFile.cpp.

void readReset (  ) [protected, virtual]

Reset stream to its beginning Called by the HTTPClient on each new request.

Definition at line 32 of file HTTPFile.cpp.

void setDataLen ( size_t  len ) [protected, virtual]

If the data is not chunked, set its size From Content-Length header.

Definition at line 100 of file HTTPFile.cpp.

void setDataType ( const char *  type ) [protected, virtual]

Set MIME type.

Parameters:
typeInternet media type from Content-Type header

Definition at line 80 of file HTTPFile.cpp.

void setIsChunked ( bool  chunked ) [protected, virtual]

Determine whether the data is chunked Recovered from Transfer-Encoding header.

Definition at line 90 of file HTTPFile.cpp.

int write ( const char *  buf,
size_t  len 
) [protected, virtual]

Write a piece of data transmitted by the server.

Parameters:
bufPointer to the buffer from which to copy the data
lenLength of the buffer

Definition at line 58 of file HTTPFile.cpp.

void writeReset (  ) [protected, virtual]

Reset stream to its beginning Called by the HTTPClient on each new request.

Definition at line 52 of file HTTPFile.cpp.