Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
struct System.​Runtime.​InteropServices.​ComTypes.​IStream
Assembly: System.Runtime.InteropServices
Provides the managed definition of the <see langword="IStream" /> interface, with <see langword="ISequentialStream" /> functionality.
Methods
public
void
Commit​(int grfCommitFlags)
grfCommitFlags
A value that controls how the changes for the stream object are committed.
Ensures that any changes made to a stream object that is open in transacted mode are reflected in the parent storage.
public
void
CopyTo​(IStream pstm,
long cb,
nint pcbRead,
nint pcbWritten)
pstm
A reference to the destination stream.
cb
The number of bytes to copy from the source stream.
pcbRead
On successful return, contains the actual number of bytes read from the source.
pcbWritten
On successful return, contains the actual number of bytes written to the destination.
Copies a specified number of bytes from the current seek pointer in the stream to the current seek pointer in another stream.
public
void
LockRegion​(long libOffset,
long cb,
int dwLockType)
libOffset
The byte offset for the beginning of the range.
cb
The length of the range, in bytes, to restrict.
dwLockType
The requested restrictions on accessing the range.
Restricts access to a specified range of bytes in the stream.
public
void
Read​(byte[] pv,
int cb,
nint pcbRead)
pv
When this method returns, contains the data read from the stream. This parameter is passed uninitialized.
cb
The number of bytes to read from the stream object.
pcbRead
A pointer to an <see langword="uint" /> variable that receives the actual number of bytes read from the stream object.
Reads a specified number of bytes from the stream object into memory starting at the current seek pointer.
public
void
Revert​()
Discards all changes that have been made to a transacted stream since the last <see cref="M:System.Runtime.InteropServices.ComTypes.IStream.Commit(System.Int32)" /> call.
public
void
Seek​(long dlibMove,
int dwOrigin,
nint plibNewPosition)
dlibMove
The displacement to add to <paramref name="dwOrigin" /> .
dwOrigin
The origin of the seek. The origin can be the beginning of the file, the current seek pointer, or the end of the file.
plibNewPosition
On successful return, contains the offset of the seek pointer from the beginning of the stream.
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
void
SetSize​(long libNewSize)
libNewSize
The new size of the stream as a number of bytes.
Changes the size of the stream object.
public
void
UnlockRegion​(long libOffset,
long cb,
int dwLockType)
libOffset
The byte offset for the beginning of the range.
cb
The length, in bytes, of the range to restrict.
dwLockType
The access restrictions previously placed on the range.
Removes the access restriction on a range of bytes previously restricted with the <see cref="M:System.Runtime.InteropServices.ComTypes.IStream.LockRegion(System.Int64,System.Int64,System.Int32)" /> method.
public
void
Write​(byte[] pv,
int cb,
nint pcbWritten)
pv
The buffer to write this stream to.
cb
The number of bytes to write to the stream.
pcbWritten
A pointer to a <see langword="uint" /> variable where this method writes the actual number of bytes written to the stream object. The caller can set this pointer to <see cref="F:System.IntPtr.Zero" /> , in which case this method does not provide the actual number of bytes written.
Writes a specified number of bytes into the stream object starting at the current seek pointer.