Methods (19) Properties (5)
Namespace: CSCore.Win32

Syntax

public class ComStream : IWriteable, IStream, Stream

Base Type

  • System.IO.Stream

Implements

Summary

Managed implementation of the IStream interface. See .

Used by

Methods

ComStream(Stream stream)

Initializes a new instance of the ComStream class.

public void ComStream(Stream stream)

Parameters

stream

Stream

Underlying Stream.

Clone(IStream& ppstm)

Creates a new stream object with its own seek pointer that references the same bytes as the original stream.

none HResult Clone(IStream& ppstm)

Parameters

ppstm

IStream&

When this method returns, contains the new stream object. This parameter is passed uninitialized.

Returns

HRESULT

Close()

Closes the current stream and releases any resources (such as sockets and file handles) associated with the current stream.

public void Close()

Commit(Int32 grfCommitFlags)

Ensures that any changes made to a stream object that is open in transacted mode are reflected in the parent storage.

none HResult Commit(Int32 grfCommitFlags)

Parameters

grfCommitFlags

Int32

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

none HResult CopyTo(IStream pstm, Int64 cb, IntPtr pcbRead, IntPtr pcbWritten)

Parameters

pstm

IStream

A reference to the destination stream.

cb

Int64

The number of bytes to copy from the source stream.

pcbRead

IntPtr

On successful return, contains the actual number of bytes read from the source.

pcbWritten

IntPtr

On successful return, contains the actual number of bytes written to the destination.

Returns

HRESULT

Dispose(Boolean disposing)

Releases the unmanaged resources used by the Stream and optionally releases the managed resources.

protected void Dispose(Boolean disposing)

Parameters

disposing

Boolean

True to release both managed and unmanaged resources; false to release only unmanaged resources.

Flush()

Clears all buffers for this stream and causes any buffered data to be written to the underlying device.

public void Flush()

LockRegion(Int64 libOffset, Int64 cb, Int32 dwLockType)

Restricts access to a specified range of bytes in the stream.

none HResult LockRegion(Int64 libOffset, Int64 cb, Int32 dwLockType)

Parameters

libOffset

Int64

The byte offset for the beginning of the range.

cb

Int64

The length of the range, in bytes, to restrict.

dwLockType

Int32

The requested restrictions on accessing the range.

Returns

HRESULT

Read(Byte[] buffer, Int32 offset, Int32 count)

Reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.

public Int32 Read(Byte[] buffer, Int32 offset, Int32 count)

Parameters

buffer

Byte[]

An array of bytes. When this method returns, the buffer contains the specified byte array with the values between offset and (offset + count - 1) replaced by the bytes read from the current source.

offset

Int32

The zero-based byte offset in buffer at which to begin storing the data read from the current stream.

count

Int32

The maximum number of bytes to be read from the current stream.

Returns

The total number of bytes read into the buffer. This can be less than the number of bytes requested if that many bytes are not currently available, or zero (0) if the end of the stream has been reached.

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.

none 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

Int32

The number of bytes to read from the stream object.

pcbRead

IntPtr

A pointer to a ULONG variable that receives the actual number of bytes read from the stream object.

Returns

HRESULT

save

reset

Drag to pan - Use Mousewheel + Ctrl to zoom

Revert()

Discards all changes that have been made to a transacted stream since the last Commit call.

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

none HResult Seek(Int64 dlibMove, Int32 dwOrigin, IntPtr plibNewPosition)

Parameters

dlibMove

Int64

The displacement to add to dwOrigin.

dwOrigin

Int32

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

IntPtr

On successful return, contains the offset of the seek pointer from the beginning of the stream.

Returns

HRESULT

Seek(Int64 offset, SeekOrigin origin)

Sets the position within the current stream.

public Int64 Seek(Int64 offset, SeekOrigin origin)

Parameters

offset

Int64

A byte offset relative to the origin parameter.

origin

SeekOrigin

A value of type SeekOrigin indicating the reference point used to obtain the new position.

Returns

The new position within the current stream.

SetLength(Int64 value)

Sets the length of the current stream.

public void SetLength(Int64 value)

Parameters

value

Int64

The desired length of the current stream in bytes.

SetSize(Int64 libNewSize)

Changes the size of the stream object.

none HResult SetSize(Int64 libNewSize)

Parameters

libNewSize

Int64

The new size of the stream as a number of bytes.

Returns

HRESULT

Stat(STATSTG& pstatstg, Int32 grfStatFlag)

Retrieves the STATSTG structure for this stream.

none 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

Int32

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

none HResult UnlockRegion(Int64 libOffset, Int64 cb, Int32 dwLockType)

Parameters

libOffset

Int64

The byte offset for the beginning of the range.

cb

Int64

The length, in bytes, of the range to restrict.

dwLockType

Int32

The access restrictions previously placed on the range.

Returns

HRESULT

Write(Byte[] buffer, Int32 offset, Int32 count)

Writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.

public void Write(Byte[] buffer, Int32 offset, Int32 count)

Parameters

buffer

Byte[]

An array of bytes. This method copies count bytes from buffer to the current stream.

offset

Int32

The zero-based byte offset in buffer at which to begin copying bytes to the current stream.

count

Int32

The number of bytes to be written to the current stream.

Write(Byte[] pv, Int32 cb, IntPtr pcbWritten)

Writes a specified number of bytes into the stream object starting at the current seek pointer.

none HResult Write(Byte[] pv, Int32 cb, IntPtr pcbWritten)

Parameters

pv

Byte[]

The buffer to write this stream to.

cb

Int32

he number of bytes to write to the stream.

pcbWritten

IntPtr

On 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

save

reset

Drag to pan - Use Mousewheel + Ctrl to zoom

Properties

CanRead

Gets a value indicating whether the current stream supports reading.

public override Boolean CanRead { get; }

CanSeek

Gets a value indicating whether the current stream supports seeking.

public override Boolean CanSeek { get; }

CanWrite

Gets a value indicating whether the current stream supports writing.

public override Boolean CanWrite { get; }

Length

Gets the length in bytes of the stream.

public override Int64 Length { get; }

Position

Gets or sets the position within the current stream.

public override Int64 Position { get; set; }