10.27.03

SDTUtilsCreateStream Method

Overload List

CreateStream(Int32) Allocates a memory buffer of size bufferSize on the heap and creates a message-independent (free standing) IStreamContainer within.

If the subsequent calls to add structured data types exceeds the buffer size an error (InsufficientSpace) is returned to the application.

Note: When using message-indpendent streams, it's an error to have more than one open subcontainer at once. In other words, client applications must close the open subcontainer before creating a new one. If such attempt is made, client applications will get an error with SDKErrorSubcode equal to OutOfMemory. Note that this limitation is not present with streams created with CreateStream(IMessage, Int32).

Note: Applications should call Dispose as soon as they're done with the stream. Message-independent containers, when created, allocate memory resources.

CreateStream(IMessage, Int32) Creates a stream container (IStreamContainer) in the binary attachment part of the given message. Any existing data is overwritten. The returned IStreamContainer instance can be later used to add SDT fields. It is recommended to Close the IStreamContainer when done. If it is not explicitly closed, the stream is automatically closed when the associated message is disposed IDisposable.

Whether it is explicitly closed by the client application, or implicitly by the API, any attempt to use this stream will result in an OperationErrorException with ParamNullReference error subcode.

See Also