WebSphere Message Brokers
File: as08220_
Writer: Lorraine Waitt

Reference topic

This build: July 31, 2007 21:38:00

cpiWriteBufferEncoded

Purpose

This function is an extension of the capability provided by the existing cpiWriteBuffer() implementation function that provides the encoding and coded character set that the output message should be represented in when the parser serialises its element tree to an output bit stream. If serialisation is not required, for example when the output based is based on an input bit stream, and the tree has not been modified, this implementation function will not be invoked by the broker. If this implementation function is provided in the CPI_VFT structure, neither cpiWriteBuffer() nor cpiWriteBufferFormatted() can be specified, because the cpiDefineParserClass() function will fail with a return code of CCI_INVALID_IMPL_FUNCTION.

Defined In Type Member
CPI_VFT Conditional iFpWriteBufferEncoded

Syntax

int cpiWriteBufferEncoded(
  CciParser*     parser,
  CciContext*    context,
  int            encoding,
  int            ccsid); 

Parameters

parser
The address of the parser object (input).
context
The address of the context owned by the parser object (input).
encoding
The encoding of the message buffer (input).
ccsid
The ccsid of the message buffer (input).

Return values

The size in bytes of the data appended to the bit stream in the buffer.

Sample

This example is taken from the sample parser file BipSampPluginParser.c (lines 612 to 642):

int cpiWriteBufferEncoded(
  CciParser*  parser,
  CciContext* context,
  int         encoding,
  int         ccsid
){
  PARSER_CONTEXT_ST* pc = (PARSER_CONTEXT_ST *)context ;
  int                initialSize = 0;
  int                rc = 0;
  const void* a;
  CciByte b;

  
  initialSize = cpiBufferSize(&rc, parser);
  a = cpiBufferPointer(&rc, parser);
  b = cpiBufferByte(&rc, parser, 0);

  cpiAppendToBuffer(&rc, parser, (char *)"Some test data", 14);

  return cpiBufferSize(0, parser) - initialSize;
}
Related concepts
User-defined parsers
User-defined extensions overview
Related tasks
Creating a parser in C
Related reference
cpiWriteBuffer
cpiWriteBufferFormatted
C parser implementation functions
Notices | Trademarks | Downloads | Library | Support | Feedback

Copyright IBM Corporation 1999, 2007Copyright IBM Corporation 1999, 2007. All Rights Reserved.
This build: July 31, 2007 21:38:00

as08220_ This topic's URL is: