IOpcFactory::WritePackageToStream method

Serializes a package that is represented by a package object.

Syntax


HRESULT WritePackageToStream(
  [in] IOpcPackage     *package,
  [in] OPC_WRITE_FLAGS flags,
  [in] IStream         *stream
);

Parameters

package [in]

A pointer to the IOpcPackage interface of the package object that contains data to be serialized.

flags [in]

The value that describes the encoding method used in serialization.

stream [in]

A pointer to the IStream interface of the stream where the package object data will be written.

Return value

The method returns an HRESULT. Possible values include, but are not limited to, those in the following table.

Return codeDescription
S_OK

The method succeeded.

E_INVALIDARG

The value passed in the flags parameter is not a valid OPC_WRITE_FLAGS enumeration value.

E_NOTIMPL

This method is not implemented for this version of Windows.

E_POINTER

At least one of the stream and package parameters is NULL.

IStream interface error

An HRESULT error code from the IStream interface.

Package Consumption error

An HRESULT error code from the Package Consumption Error Group.

Part URI error

An HRESULT error code from the Part URI Error Group.

 

Remarks

Do not use a stream to serialize package data when the same stream is being used to deserialize a package, because the attempt may result in undefined behavior.

For information about how to use this method to save a package that is represented as a package object, see the Saving a Package programming task.

Support on Previous Versions of Windows

This method is not supported on versions of Windows prior to Windows 7. For more information, see Getting Started with the Packaging API, and Platform Update for Windows Vista.

Thread Safety

Packaging objects are not thread-safe.

For more information, see the Getting Started with the Packaging API.

Requirements

Minimum supported client

Windows 7 [desktop apps only]

Minimum supported server

Windows Server 2008 R2 [desktop apps only]

Header

Msopc.h

IDL

Msopc.idl

See also

IOpcFactory
Overviews
Packaging API Programming Guide
Getting Started with the Packaging API
Platform Update for Windows Vista
Saving a Package
Reference
OPC_WRITE_FLAGS
Packaging Errors
Packaging API Reference
Packaging API Samples

 

 

Community Additions

ADD
Show: