public interface IStream
Provides the managed definition of the IStream interface.
Clone(IStream& ppstm)
Creates a new stream object with its own seek pointer that references the same bytes as the original stream.
public abstract HResult Clone(IStream& ppstm)
Parameters
ppstm
IStream&When this method returns, contains the new stream object. This parameter is passed uninitialized.
Returns
HRESULT
Commit(Int32 grfCommitFlags)
Ensures that any changes made to a stream object that is open in transacted mode are reflected in the parent storage.
public abstract HResult Commit(Int32 grfCommitFlags)
Parameters
grfCommitFlags
Int32A value that controls how the changes for the stream object are committed.
Returns
HRESULT
CopyTo(IStream pstm, Int64 cb, IntPtr pcbRead, IntPtr pcbWritten)
Copies a specified number of bytes from the current seek pointer in the stream to the current seek pointer in another stream.
public abstract HResult CopyTo(IStream pstm, Int64 cb, IntPtr pcbRead, IntPtr pcbWritten)
Parameters
pstm
IStreamA reference to the destination stream.
cb
Int64The number of bytes to copy from the source stream.
pcbRead
IntPtrOn successful return, contains the actual number of bytes read from the source.
pcbWritten
IntPtrOn successful return, contains the actual number of bytes written to the destination.
Returns
HRESULT
LockRegion(Int64 libOffset, Int64 cb, Int32 dwLockType)
Restricts access to a specified range of bytes in the stream.
public abstract HResult LockRegion(Int64 libOffset, Int64 cb, Int32 dwLockType)
Parameters
libOffset
Int64The byte offset for the beginning of the range.
cb
Int64The length of the range, in bytes, to restrict.
dwLockType
Int32The requested restrictions on accessing the range.
Returns
HRESULT
Read(Byte[] pv, Int32 cb, IntPtr pcbRead)
Reads a specified number of bytes from the stream object into memory starting at the current seek pointer.
public abstract HResult Read(Byte[] pv, Int32 cb, IntPtr pcbRead)
Parameters
pv
Byte[]When this method returns, contains the data read from the stream. This parameter is passed uninitialized.
cb
Int32The number of bytes to read from the stream object.
pcbRead
IntPtrA pointer to a ULONG variable that receives the actual number of bytes read from the stream object.
Returns
HRESULT
Revert()
Discards all changes that have been made to a transacted stream since the last Commit call.
public abstract HResult Revert()
Returns
HRESULT
Seek(Int64 dlibMove, Int32 dwOrigin, IntPtr plibNewPosition)
Changes the seek pointer to a new location relative to the beginning of the stream, to the end of the stream, or to the current seek pointer.
public abstract HResult Seek(Int64 dlibMove, Int32 dwOrigin, IntPtr plibNewPosition)
Parameters
dlibMove
Int64The displacement to add to dwOrigin.
dwOrigin
Int32The origin of the seek. The origin can be the beginning of the file, the current seek pointer, or the end of the file.
plibNewPosition
IntPtrOn successful return, contains the offset of the seek pointer from the beginning of the stream.
Returns
HRESULT
SetSize(Int64 libNewSize)
Changes the size of the stream object.
public abstract HResult SetSize(Int64 libNewSize)
Parameters
libNewSize
Int64The new size of the stream as a number of bytes.
Returns
HRESULT
Stat(STATSTG& pstatstg, Int32 grfStatFlag)
Retrieves the STATSTG structure for this stream.
public abstract HResult Stat(STATSTG& pstatstg, Int32 grfStatFlag)
Parameters
pstatstg
STATSTG&When this method returns, contains a STATSTG structure that describes this stream object. This parameter is passed uninitialized.
grfStatFlag
Int32Members in the STATSTG structure that this method does not return, thus saving some memory allocation operations.
Returns
HRESULT
UnlockRegion(Int64 libOffset, Int64 cb, Int32 dwLockType)
Removes the access restriction on a range of bytes previously restricted with the LockRegion method.
public abstract HResult UnlockRegion(Int64 libOffset, Int64 cb, Int32 dwLockType)
Parameters
libOffset
Int64The byte offset for the beginning of the range.
cb
Int64The length, in bytes, of the range to restrict.
dwLockType
Int32The access restrictions previously placed on the range.
Returns
HRESULT
Write(Byte[] pv, Int32 cb, IntPtr pcbWritten)
Writes a specified number of bytes into the stream object starting at the current seek pointer.
public abstract HResult Write(Byte[] pv, Int32 cb, IntPtr pcbWritten)
Parameters
pv
Byte[]The buffer to write this stream to.
cb
Int32he number of bytes to write to the stream.
pcbWritten
IntPtrOn successful return, contains the actual number of bytes written to the stream object. If the caller sets this pointer to Zero, this method does not provide the actual number of bytes written.
Returns
HRESULT