Axis2/C: stream

- Main Page
- Modules
- Classes
- Files
- Directories
- Related Pages
- Examples

- Search for |

# stream
[utilities]

## Classes
struct | axutil_stream
## Typedefs
typedef enum axutil_stream_type | axutil_stream_type_t
typedef struct axutil_stream | axutil_stream_t
typedef int(* | AXUTIL_STREAM_READ )(axutil_stream_t *stream, const axutil_env_t *env, void *buffer, size_t count)
typedef int(* | AXUTIL_STREAM_WRITE )(axutil_stream_t *stream, const axutil_env_t *env, const void *buffer, size_t count)
typedef int(* | AXUTIL_STREAM_SKIP )(axutil_stream_t *stream, const axutil_env_t *env, int count)
## Enumerations
enum | axutil_stream_type { AXIS2_STREAM_BASIC = 0, AXIS2_STREAM_FILE, AXIS2_STREAM_SOCKET, AXIS2_STREAM_MANAGED }
| Axis2 stream types. More...
## Functions
AXIS2_EXTERN void | axutil_stream_free (axutil_stream_t *stream, const axutil_env_t *env)
AXIS2_EXTERN void | axutil_stream_free_void_arg (void *stream, const axutil_env_t *env)
AXIS2_EXTERN int | axutil_stream_read (axutil_stream_t *stream, const axutil_env_t *env, void *buffer, size_t count)
AXIS2_EXTERN int | axutil_stream_write (axutil_stream_t *stream, const axutil_env_t *env, const void *buffer, size_t count)
AXIS2_EXTERN int | axutil_stream_skip (axutil_stream_t *stream, const axutil_env_t *env, int count)
AXIS2_EXTERN int | axutil_stream_get_len (axutil_stream_t *stream, const axutil_env_t *env)
AXIS2_EXTERN axutil_stream_t * | axutil_stream_create_basic (const axutil_env_t *env)
| Constructor for creating an in memory stream.
AXIS2_EXTERN axutil_stream_t * | axutil_stream_create_file (const axutil_env_t *env, FILE *fp)
| Constructor for creating a file stream.
AXIS2_EXTERN axutil_stream_t * | axutil_stream_create_socket (const axutil_env_t *env, int socket)
| Constructor for creating a file stream.
AXIS2_EXTERN axis2_char_t * | axutil_stream_get_buffer (const axutil_stream_t *stream, const axutil_env_t *env)
AXIS2_EXTERN axis2_status_t | axutil_stream_flush_buffer (axutil_stream_t *stream, const axutil_env_t *env)
AXIS2_EXTERN int | axutil_stream_peek_socket (axutil_stream_t *stream, const axutil_env_t *env, void *buffer, size_t count)
AXIS2_EXTERN axis2_status_t | axutil_stream_flush (axutil_stream_t *stream, const axutil_env_t *env)
AXIS2_EXTERN axis2_status_t | axutil_stream_close (axutil_stream_t *stream, const axutil_env_t *env)
AXIS2_EXTERN axis2_status_t | axutil_stream_set_read (axutil_stream_t *stream, const axutil_env_t *env, AXUTIL_STREAM_READ func)
AXIS2_EXTERN axis2_status_t | axutil_stream_set_write (axutil_stream_t *stream, const axutil_env_t *env, AXUTIL_STREAM_WRITE func)
AXIS2_EXTERN axis2_status_t | axutil_stream_set_skip (axutil_stream_t *stream, const axutil_env_t *env, AXUTIL_STREAM_SKIP func)

## Enumeration Type Documentation

enum axutil_stream_type

Axis2 stream types.

This is used to create a stream to correspond to particular i/o mtd

## Function Documentation

AXIS2_EXTERN axutil_stream_t* axutil_stream_create_basic | ( | const axutil_env_t * | env | ) |

Constructor for creating an in memory stream.

Returns:
  axutil_stream (in memory)

AXIS2_EXTERN axutil_stream_t* axutil_stream_create_file | ( | const axutil_env_t * | env,
|  | FILE * | fp |
| ) |  |  |

Constructor for creating a file stream.

Parameters:

  | valid | file pointer (opened file)

Returns:
  axutil_stream (file)

AXIS2_EXTERN axutil_stream_t* axutil_stream_create_socket | ( | const axutil_env_t * | env,
|  | int | socket |
| ) |  |  |

Constructor for creating a file stream.

Parameters:

  | valid | socket (opened socket)

Returns:
  axutil_stream (socket)

AXIS2_EXTERN void axutil_stream_free | ( | axutil_stream_t * | stream,
|  | const axutil_env_t * | env |
| ) |  |  |

Deletes the stream

Returns:
  axis2_status_t AXIS2_SUCCESS on success else AXIS2_FAILURE

Free stream

AXIS2_EXTERN void axutil_stream_free_void_arg | ( | void * | stream,
|  | const axutil_env_t * | env |
| ) |  |  |

Free stream passed as void pointer. This will be cast into appropriate type and then pass the cast object into the module_desc structure's free method

AXIS2_EXTERN axis2_char_t* axutil_stream_get_buffer | ( | const axutil_stream_t * | stream,
|  | const axutil_env_t * | env |
| ) |  |  |

Gets the buffer

AXIS2_EXTERN int axutil_stream_get_len | ( | axutil_stream_t * | stream,
|  | const axutil_env_t * | env |
| ) |  |  |

Returns the length of the stream (applicable only to basic stream)

Returns:
  Length of the buffer if its type is basic, else -1 (we can't define a length of a stream unless it is just a buffer)

AXIS2_EXTERN int axutil_stream_read | ( | axutil_stream_t * | stream,
|  | const axutil_env_t * | env,
|  | void * | buffer,
|  | size_t | count |
| ) |  |  |

reads from stream

Parameters:

  | buffer | buffer into which the content is to be read
  | count | size of the buffer

Returns:
  no: of bytes read

AXIS2_EXTERN int axutil_stream_skip | ( | axutil_stream_t * | stream,
|  | const axutil_env_t * | env,
|  | int | count |
| ) |  |  |

Skips over and discards n bytes of data from this input stream.

Parameters:

  | count | number of bytes to be discarded

Returns:
  no: of bytes actually skipped

AXIS2_EXTERN int axutil_stream_write | ( | axutil_stream_t * | stream,
|  | const axutil_env_t * | env,
|  | const void * | buffer,
|  | size_t | count |
| ) |  |  |

writes into stream

Parameters:

  | buffer | buffer to be written
  | count | size of the buffer

Returns:
  no: of bytes actually written