C# Class SIL.Utils.TextWriterStream

Implementation of the COM IStream interface that wraps a C# TextWriter object. This is useful for calling the ITsString.WriteAsXml method from C# code.
Inheritance: IStream
Mostra file Open project: sillsdev/FieldWorks Class Usage Examples

Public Methods

Method Description
Clone ( IStream &pstm ) : void

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

Commit ( int grfCommitFlags ) : void

Ensures that any changes made to a stream object opened in transacted mode are reflected in the parent storage object. If the stream object is opened in direct mode, this method has no effect other than flushing all memory buffers to the next level storage object. The OLE compound file implementation of streams does not support opening streams in transacted mode.

CopyTo ( IStream pstm, long cb, System pcbRead, System pcbWritten ) : void

Copies a specified number of bytes from the current seek pointer in the stream to the current seek pointer in another stream.

LockRegion ( System.Int64 libOffset, System.Int64 cb, int dwLockType ) : void

Restricts access to a specified range of bytes in the stream. Supporting this functionality is optional because some file systems do not provide it.

Read ( byte pv, int cb, System pcbRead ) : void

Reads a specified number of bytes from the stream object into memory, starting at the current seek pointer.

Revert ( ) : void

Discards all changes that have been made to a transacted stream since the last IStream::Commit call. This method has no effect on streams open in direct mode and streams using the OLE compound file implementation of IStream::Revert.

Seek ( long dlibMove, int dwOrigin, System plibNewPosition ) : void

Changes the seek pointer to a new location relative to the current seek pointer or the beginning or end of the stream.

SetSize ( long libNewSize ) : void

Resizes of the stream object.

Stat ( STATSTG &pstatstg, int grfStatFlag ) : void

Retrieves the STATSTG structure for this stream object.

TextWriterStream ( TextWriter writer ) : System

Constructor.

UnlockRegion ( long libOffset, long cb, int dwLockType ) : void

Removes the access restriction on a range of bytes previously restricted with IStream::LockRegion.

Write ( byte pv, int cb, System pcbWritten ) : void

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

Method Details

Clone() public method

Creates a new stream object with its own seek pointer that references the same bytes as the original stream.
public Clone ( IStream &pstm ) : void
pstm IStream
return void

Commit() public method

Ensures that any changes made to a stream object opened in transacted mode are reflected in the parent storage object. If the stream object is opened in direct mode, this method has no effect other than flushing all memory buffers to the next level storage object. The OLE compound file implementation of streams does not support opening streams in transacted mode.
public Commit ( int grfCommitFlags ) : void
grfCommitFlags int
return void

CopyTo() public method

Copies a specified number of bytes from the current seek pointer in the stream to the current seek pointer in another stream.
public CopyTo ( IStream pstm, long cb, System pcbRead, System pcbWritten ) : void
pstm IStream
cb long
pcbRead System
pcbWritten System
return void

LockRegion() public method

Restricts access to a specified range of bytes in the stream. Supporting this functionality is optional because some file systems do not provide it.
public LockRegion ( System.Int64 libOffset, System.Int64 cb, int dwLockType ) : void
libOffset System.Int64
cb System.Int64
dwLockType int
return void

Read() public method

Reads a specified number of bytes from the stream object into memory, starting at the current seek pointer.
public Read ( byte pv, int cb, System pcbRead ) : void
pv byte
cb int
pcbRead System
return void

Revert() public method

Discards all changes that have been made to a transacted stream since the last IStream::Commit call. This method has no effect on streams open in direct mode and streams using the OLE compound file implementation of IStream::Revert.
public Revert ( ) : void
return void

Seek() public method

Changes the seek pointer to a new location relative to the current seek pointer or the beginning or end of the stream.
public Seek ( long dlibMove, int dwOrigin, System plibNewPosition ) : void
dlibMove long
dwOrigin int
plibNewPosition System
return void

SetSize() public method

Resizes of the stream object.
public SetSize ( long libNewSize ) : void
libNewSize long
return void

Stat() public method

Retrieves the STATSTG structure for this stream object.
public Stat ( STATSTG &pstatstg, int grfStatFlag ) : void
pstatstg System.Runtime.InteropServices.ComTypes.STATSTG
grfStatFlag int
return void

TextWriterStream() public method

Constructor.
public TextWriterStream ( TextWriter writer ) : System
writer System.IO.TextWriter
return System

UnlockRegion() public method

Removes the access restriction on a range of bytes previously restricted with IStream::LockRegion.
public UnlockRegion ( long libOffset, long cb, int dwLockType ) : void
libOffset long
cb long
dwLockType int
return void

Write() public method

Writes a specified number of bytes into the stream object starting at the current seek pointer.
public Write ( byte pv, int cb, System pcbWritten ) : void
pv byte
cb int
pcbWritten System
return void