Interface IStream
For more information, refer to documentation on MSDN for interface with the same name.
Namespace: Syncfusion.CompoundFile.DocIO.Native
Assembly: Syncfusion.DocIO.Base.dll
Syntax
[CLSCompliant(false)]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
[Guid("0000000c-0000-0000-C000-000000000046")]
public interface IStream
Methods
Clone(ref IStream)
Creates a new stream object that references the same bytes as the original stream but provides a separate seek pointer to those bytes.
Declaration
int Clone(ref IStream ppstm)
Parameters
Type | Name | Description |
---|---|---|
IStream | ppstm |
Returns
Type |
---|
System.Int32 |
Commit(UInt32)
Ensures that any changes made to a stream object open in transacted mode are reflected in the parent storage. If the stream object is open in direct mode, IStream::Commit has no effect other than flushing all memory buffers to the next-level storage object. The COM compound file implementation of streams does not support opening streams in transacted mode.
Declaration
int Commit(uint grfCommitFlags)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | grfCommitFlags | [in] Controls how the changes for the stream object are committed. See the STGC enumeration for a definition of these values. |
Returns
Type |
---|
System.Int32 |
CopyTo(IStream, UInt64, ref UInt64, ref UInt64)
Copies a specified number of bytes from the current seek pointer in the stream to the current seek pointer in another stream.
Declaration
int CopyTo(IStream pstm, ulong cb, ref ulong pcbRead, ref ulong pcbWritten)
Parameters
Type | Name | Description |
---|---|---|
IStream | pstm | [in] Pointer to the destination stream. The stream pointed to by pstm can be a new stream or a clone of the source stream. |
System.UInt64 | cb | [in] Specifies the number of bytes to copy from the source stream. |
System.UInt64 | pcbRead | [out] Pointer to the location where this method writes the actual number of bytes read from the source. You can set this pointer to NULL to indicate that you are not interested in this value. In this case, this method does not provide the actual number of bytes read. |
System.UInt64 | pcbWritten | [out] Pointer to the location where this method writes the actual number of bytes written to the destination. You can set this pointer to NULL to indicate that you are not interested in this value. In this case, this method does not provide the actual number of bytes written. |
Returns
Type |
---|
System.Int32 |
LockRegion(UInt64, UInt64, UInt32)
Restricts access to a specified range of bytes in the stream. Supporting this functionality is optional since some file systems do not provide it.
Declaration
int LockRegion(ulong libOffset, ulong cb, uint dwLockType)
Parameters
Type | Name | Description |
---|---|---|
System.UInt64 | libOffset | |
System.UInt64 | cb | |
System.UInt32 | dwLockType |
Returns
Type |
---|
System.Int32 |
Read(Byte[], UInt32, ref UInt32)
Reads a specified number of bytes from the stream object into memory starting at the current seek pointer.
Declaration
int Read(byte[] pv, uint cb, ref uint pcbRead)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | pv | [out] Pointer to the buffer into which the stream data is read. |
System.UInt32 | cb | [in] Specifies the number of bytes of data to attempt to read from the stream object. |
System.UInt32 | pcbRead | [out] Pointer to a ULONG variable that receives the actual number of bytes read from the stream object. You can set this pointer to NULL to indicate that you are not interested in this value. In this case, this method does not provide the actual number of bytes read. |
Returns
Type | Description |
---|---|
System.Int32 | S_OK Data was successfully read from the stream object. S_FALSE The data could not be read from the stream object. E_PENDING Asynchronous storage only: Part or all of the data to be read is currently unavailable. For more information, see IFillLockBytes and Asynchronous Storage. STG_E_ACCESSDENIED The caller does not have enough permissions for reading this stream object. STG_E_INVALIDPOINTER One of the pointer values is not valid. STG_E_REVERTED The object has been invalidated by a revert operation above it in the transaction tree. |
Revert()
Discards all changes that have been made to a transacted stream since the last call to IStream::Commit.
Declaration
int Revert()
Returns
Type |
---|
System.Int32 |
Seek(Int64, SeekOrigin, out Int64)
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.
Declaration
int Seek(long dlibMove, SeekOrigin dwOrigin, out long plibNewPosition)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | dlibMove | [in] Displacement to be added to the location indicated by the dwOrigin parameter. If dwOrigin is STREAM_SEEK_SET, this is interpreted as an unsigned value rather than a signed value. |
System.IO.SeekOrigin | dwOrigin | [in] Specifies the origin for the displacement specified in dlibMove. The origin can be the beginning of the file, the current seek pointer, or the end of the file. See the STREAM_SEEK enumeration for the values. |
System.Int64 | plibNewPosition | [out] Pointer to the location where this method writes the value of the new seek pointer from the beginning of the stream. You can set this pointer to NULL to indicate that you are not interested in this value. In this case, this method does not provide the new seek pointer. |
Returns
Type | Description |
---|---|
System.Int32 | S_OK The seek pointer has been successfully adjusted. E_PENDING Asynchronous Storage only: Part or all of the stream's data is currently unavailable. For more information, see IFillLockBytes and Asynchronous Storage. STG_E_INVALIDPOINTER Indicates that the [out] parameter plibNewPosition points to invalid memory, because plibNewPosition is not read. STG_E_INVALIDFUNCTION The dwOrigin parameter contains an invalid value or the dlibMove parameter contains a bad offset value. For example, the result of the seek pointer is a negative offset value. STG_E_REVERTED The object has been invalidated by a revert operation above it in the transaction tree. |
SetSize(UInt64)
Changes the size of the stream object.
Declaration
int SetSize(ulong libNewSize)
Parameters
Type | Name | Description |
---|---|---|
System.UInt64 | libNewSize | [in] Specifies the new size of the stream as a number of bytes. |
Returns
Type |
---|
System.Int32 |
Stat(ref STATSTG, UInt32)
Retrieves the STATSTG structure for this stream.
Declaration
int Stat(ref STATSTG pstatstg, uint grfStatFlag)
Parameters
Type | Name | Description |
---|---|---|
STATSTG | pstatstg | |
System.UInt32 | grfStatFlag |
Returns
Type |
---|
System.Int32 |
UnlockRegion(UInt64, UInt64, UInt32)
Removes the access restriction on a range of bytes previously restricted with IStream::LockRegion.
Declaration
int UnlockRegion(ulong libOffset, ulong cb, uint dwLockType)
Parameters
Type | Name | Description |
---|---|---|
System.UInt64 | libOffset | |
System.UInt64 | cb | |
System.UInt32 | dwLockType |
Returns
Type |
---|
System.Int32 |
Write(Byte[], UInt32, ref UInt32)
Writes a specified number of bytes into the stream object starting at the current seek pointer.
Declaration
int Write(byte[] pv, uint cb, ref uint pcbWritten)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | pv | [in] Pointer to the buffer containing the data that is to be written to the stream. A valid pointer must be provided for this parameter even when cb is zero. |
System.UInt32 | cb | [in] The number of bytes of data to attempt to write into the stream. Can be zero. |
System.UInt32 | pcbWritten | [out] Pointer to a ULONG variable where this method writes the actual number of bytes written to the stream object. The caller can set this pointer to NULL, in which case this method does not provide the actual number of bytes written. |
Returns
Type | Description |
---|---|
System.Int32 | S_OK The data was successfully written to the stream object. E_PENDING Asynchronous Storage only: Part or all of the data to be written is currently unavailable. For more information, see IFillLockBytes and Asynchronous Storage. STG_E_MEDIUMFULL The write operation was not completed because there is no space left on the storage device. STG_E_ACCESSDENIED The caller does not have enough permissions for writing to this stream object. STG_E_CANTSAVE Data cannot be written for reasons other than improper access or insufficient space. STG_E_INVALIDPOINTER One of the pointer values is not valid. The pv parameter must contain a valid pointer even if cb is zero. STG_E_REVERTED The object has been invalidated by a revert operation above it in the transaction tree. STG_E_WRITEFAULT The write operation was not completed due to a disk error. This value is also returned when this method attempts to write to a stream that was opened in simple mode (using the STGM_SIMPLE flag). |