|
|
|
IStream Interface |
|
IID_IStream |
{0000000C-0000-0000-C000-000000000046} |
|
The IStream interface lets you read and write data to stream objects. Stream objects contain the data in a structured storage object, where storages provide the structure. Simple data can be written directly to a stream but, most frequently, streams are elements nested within a storage object. They are similar to standard files.
The IStream interface defines methods similar to the MS-DOS FAT file functions. For example, each stream object has its own access rights and a seek pointer. The main difference between a DOS file and a stream object is that in the latter case, streams are opened using an IStream interface pointer rather than a file handle.
The methods in this interface present your object's data as a contiguous sequence of bytes that you can read or write. There are also methods for committing and reverting changes on streams that are open in transacted mode and methods for restricting access to a range of bytes in the stream.
Streams can remain open for long periods of time without consuming file-system resources. The IUnknown::Release method is similar to a close function on a file. Once released, the stream object is no longer valid and cannot be used.
Clients of asynchronous monikers can choose between a data-pull or data-push model for driving an asynchronous IMoniker::BindToStorage operation and for receiving asynchronous notifications. See URL Monikers for more information.
Call the methods of the IStream interface from a container or application to read and write the data for an object. Since stream objects can be marshaled to other processes, applications can share the data in storage objects without having to use global memory.
|
|
Methods in VTable order |
|
|
IUnknown Methods |
Description |
|
QueryInterface |
Returns pointers to supported interfaces. |
|
AddRef |
Increments reference count. |
|
Release |
Decrements reference count. |
|
ISequentialStream Methods |
Description |
|
Read |
The Read method reads a specified number of bytes from the stream object into memory, starting at the current seek pointer. |
|
Write |
The Write method writes a specified number of bytes into the stream object starting at the current seek pointer. |
|
IStream Methods |
Description |
|
Seek |
Changes the seek pointer to a new location relative to the beginning of the stream, the end of the stream, or the current seek pointer. |
|
SetSize |
Changes the size of the stream object. |
|
CopyTo |
Copies a specified number of bytes from the current seek pointer in the stream to the current seek pointer in another stream. |
|
Commit |
Ensures that any changes made to a stream object open in transacted mode are reflected in the parent storage object. |
|
Revert |
Discards all changes that have been made to a transacted stream since the last call to IStream::Commit. |
|
LockRegion |
Supporting this functionality is optional since some file systems do not provide it. |
|
UnlockRegion |
Removes the access restriction on a range of bytes previously restricted with IStream::LockRegion. |
|
Stat |
Retrieves the STATSTG structure for this stream. |
|
Clone |
Creates a new stream object that references the same bytes as the original stream but provides a separate seek pointer to those bytes. |
|
QueryInterface |
|
FUNCTION IStream_QueryInterface ( _ BYVAL pthis AS DWORD PTR _ , BYREF riid AS GUID _ , BYREF ppvObj AS DWORD _ ) AS LONG
END FUNCTION
|
|
AddRef |
|
FUNCTION IStream_AddRef ( _ BYVAL pthis AS DWORD PTR _
)
AS DWORD
LOCAL DWRESULT
AS LONG END FUNCTION
|
|
Release |
|
FUNCTION IStream_Release ( _ BYVAL pthis AS DWORD PTR _
)
AS DWORD
LOCAL DWRESULT
AS DWORD END FUNCTION
|
|
Read |
|
FUNCTION IStream_Read ( _ BYVAL pthis AS DWORD PTR _ , BYVAL pv AS DWORD _ , BYVAL cb AS DWORD _ , BYREF pcbRead AS DWORD _ ) AS LONG
LOCAL HRESULT AS LONG END FUNCTION
|
|
Write |
|
FUNCTION IStream_Write ( _ BYVAL pthis AS DWORD PTR _ , BYVAL pv AS DWORD _ , BYVAL cb AS DWORD _ , BYREF pcbWritten AS DWORD _ )
AS LONG
LOCAL HRESULT AS LONG END FUNCTION
|
|
Seek |
|
FUNCTION IStream_Seek ( _ BYVAL pthis AS DWORD PTR _ , BYVAL dlibMove AS QUAD _ , BYVAL dwOrigin AS DWORD _ , BYREF plibNewPosition AS QUAD _
)
AS LONG
LOCAL HRESULT AS LONG END FUNCTION
|
|
SetSize |
|
FUNCTION IStream_SetSize ( _ BYVAL pthis AS DWORD PTR _ , BYVAL libNewSize AS QUAD _
) AS LONG
LOCAL HRESULT AS LONG END FUNCTION
|
|
CopyTo |
|
FUNCTION IStream_CopyTo ( _ BYVAL pthis AS DWORD PTR _ , BYVAL pStm AS DWORD _ , BYVAL cb AS QUAD _ , BYREF pcbRead AS QUAD _ , BYREF pcbWritten AS QUAD _
)
AS LONG
LOCAL HRESULT AS LONG END FUNCTION
|
|
Commit |
|
FUNCTION IStream_Commit ( _ BYVAL pthis AS DWORD PTR _ , BYVAL grfCommitFlags AS DWORD _
) AS LONG
LOCAL HRESULT AS LONG END FUNCTION
|
|
Revert |
|
FUNCTION IStream_Revert ( _ BYVAL pthis AS DWORD PTR _
) AS LONG
LOCAL HRESULT AS LONG
|
|
LockRegion |
|
FUNCTION IStream_LockRegion ( _ BYVAL pthis AS DWORD PTR _ , BYVAL libOffset AS QUAD _ , BYVAL cb AS QUAD _ , BYVAL dwLockType AS DWORD _
)
AS LONG
LOCAL HRESULT AS LONG END FUNCTION
|
|
UnlockRegion |
|
FUNCTION IStream_UnlockRegion ( _ BYVAL pthis AS DWORD PTR _ , BYVAL libOffset AS QUAD _ , BYVAL cb AS QUAD _ , BYVAL dwLockType AS DWORD _
)
AS LONG
LOCAL HRESULT AS LONG END FUNCTION
|
|
Stat |
|
FUNCTION IStream_Stat ( _ BYVAL pthis AS DWORD PTR _ , BYREF pstatstg AS STATSTG _ , BYVAL grfStatFlag AS DWORD _
)
AS LONG
LOCAL HRESULT AS LONG END FUNCTION
|
|
Clone |
|
FUNCTION IStream_Clone ( _ BYVAL pthis AS DWORD PTR _ , BYREF ppstm AS DWORD _
) AS
LONG
LOCAL HRESULT AS LONG END FUNCTION
|
Page last updated on Thursday, 16 March 2006 03:19:48 +0100