Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

IOpcFactory::ReadPackageFromStream method

Deserializes package data from a stream and creates a package object to represent the package being read. While a Packaging API object obtained from the package object, or the package object itself, is still in use, the stream may be used to access package data.

Syntax


HRESULT ReadPackageFromStream(
  [in]           IStream *stream,
  [in]           OPC_READ_FLAGS flags,
  [out, retval]  IOpcPackage **package
);

Parameters

stream [in]

A pointer to the IStream interface of the stream.

The stream must be readable, seekable, have size, and must contain package data. Additionally, if the stream is not clonable, it will be buffered and read sequentially, incurring overhead.

flags [in]

The value that specifies the read settings for caching package components and validating them against OPC conformance requirements.

package [out, retval]

A pointer to the IOpcPackage interface of the package object that represents the package being read through the stream.

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_READ_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.

The Packaging APIs can interact with packages that map a ZIP archive as specified in the OPC, and that are based on either Zip32 (ZIP 2.0) or Zip64 (ZIP 4.5) encoding.

For information about how to use this method to load a package, see the Loading 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
Loading a Package
Getting Started with the Packaging API
Packaging API Programming Guide
Platform Update for Windows Vista
Reference
OPC_READ_FLAGS
Packaging Errors
Packaging API Reference
Packaging API Samples

 

 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.