# wso2wsf::OMDataHandler Class Reference
[OM Data Handler]

class OMDataHandler This class provides an interface to manipulate data in different sources and formats. It provides mechanisms of obtaining streams, reading and writing to files etc. This class has a great deal of importance with respect to attachments. More...

`#include <OMDataHandler.h>`

List of all members.

## Public Member Functions
WSF_EXTERN | OMDataHandler (std::string file_name, std::string mime_type)
WSF_EXTERN | OMDataHandler (std::string mime_type)
WSF_EXTERN | OMDataHandler ()
| ~OMDataHandler ()
axiom_data_handler_t * | getAxiomDataHandler ()
void | setAxiomDataHandler (axiom_data_handler_t *data_handler)
WSF_EXTERN std::string | getContentType ()
WSF_EXTERN axis2_byte_t * | getInputStream ()
WSF_EXTERN int | getInputStreamLength ()
WSF_EXTERN bool | read (axis2_byte_t **output_stream, int *output_stream_length)
WSF_EXTERN bool | write (axis2_byte_t *input_stream, int input_stream_length)
WSF_EXTERN bool | setFileName (std::string file_name)
WSF_EXTERN bool | isCached ()
WSF_EXTERN bool | writeTo (std::string filename)

## Detailed Description

class OMDataHandler This class provides an interface to manipulate data in different sources and formats. It provides mechanisms of obtaining streams, reading and writing to files etc. This class has a great deal of importance with respect to attachments.

## Constructor & Destructor Documentation

WSF_EXTERN wso2wsf::OMDataHandler::OMDataHandler | ( | std::string | file_name,
|  | std::string | mime_type |
| ) |  |  |

Constructor for OMDataHandler.

Parameters:

  | file_name | associated file name.
  | mime_type | mime type.

WSF_EXTERN wso2wsf::OMDataHandler::OMDataHandler | ( | std::string | mime_type | ) |

Constructor for OMDataHandler.

Parameters:

  | mime_type | mime type.

WSF_EXTERN wso2wsf::OMDataHandler::OMDataHandler | ( |  | ) |

Constructor for OMDataHandler with no arguments.

wso2wsf::OMDataHandler::~OMDataHandler | ( |  | ) |

Destructor that frees resources.

## Member Function Documentation

axiom_data_handler_t* wso2wsf::OMDataHandler::getAxiomDataHandler | ( |  | ) |

Method to get the reference to the axiom_data_handler struct.

Returns:
  reference to the axiom_data_handler struct.

WSF_EXTERN std::string wso2wsf::OMDataHandler::getContentType | ( |  | ) |

Gets content type.

Returns:
  content type.

WSF_EXTERN axis2_byte_t* wso2wsf::OMDataHandler::getInputStream | ( |  | ) |

Method to get the input stream.

Returns:
  reference to input stream.

WSF_EXTERN int wso2wsf::OMDataHandler::getInputStreamLength | ( |  | ) |

Method to get the input stream length.

Returns:
  length of input stream.

WSF_EXTERN bool wso2wsf::OMDataHandler::isCached | ( |  | ) |

Returns whether the attachment is cached or not

Returns:
  true if attachment is cached and false otherwise

WSF_EXTERN bool wso2wsf::OMDataHandler::read | ( | axis2_byte_t ** | output_stream,
|  | int * | output_stream_length |
| ) |  |  |

Method to read into a stream.

Parameters:

  | output_stream | reference to which the stream would be retrieved.
  | output_stream_length | size of retrieved stream.

Returns:
  true if operation was successful, false otherwise.

void wso2wsf::OMDataHandler::setAxiomDataHandler | ( | axiom_data_handler_t * | data_handler | ) |

Method to set the reference to the axiom_data_handler struct.

Parameters:

  | data_handler | reference to the axiom_data_handler struct.

WSF_EXTERN bool wso2wsf::OMDataHandler::setFileName | ( | std::string | file_name | ) |

Method to set file name.

Parameters:

  | file_name | associated file name.

Returns:
  true if operation was successful, false otherwise.

WSF_EXTERN bool wso2wsf::OMDataHandler::write | ( | axis2_byte_t * | input_stream,
|  | int | input_stream_length |
| ) |  |  |

Method to write to a stream.

Parameters:

  | input_stream | stream to use.
  | input_stream_length | size of input stream.

Returns:
  true if operation was successful, false otherwise.

WSF_EXTERN bool wso2wsf::OMDataHandler::writeTo | ( | std::string | filename | ) |

Write to a file.The filename is the file to be written.

Parameters:

  | filename | Name of the file to which the binary content will be written by the DataHandler. Returns the true if the operation is successful, false otherwise

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

- OMDataHandler.h