Enhanced C#
Loyc library documentation
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
Public fields | Properties | Public Member Functions | Static Public Member Functions | Protected fields | List of all members
StreamScanner Class Reference

An implementation of IScanner{T} that reads from a Stream. More...


Source file:
Inheritance diagram for StreamScanner:

Remarks

An implementation of IScanner{T} that reads from a Stream.

This class assumes that no other code will seek/read/write in the stream while this class is using it. It does not require CanSeek to be true on the stream, but if it is, then CanScanBackward will be true, and Position will be fully functional.

Public fields

bool CanScanBackward => _stream.CanSeek
 

Properties

int MinBlockSize [get, set]
 The minimum amount of data to read from the stream at once. More...
 
long Position [get, set]
 Gets or sets the stream's Position. If the stream is not seekable, the getter returns the position relative to the stream position when this object was constructed, and the setter cannot be used. More...
 

Public Member Functions

 StreamScanner (Stream stream, int minBlockSize=0x10000, bool disposeStream=true)
 
ReadOnlyMemory< byte > Read (int skip, int minLength, ref Memory< byte > buffer)
 
void Dispose ()
 

Static Public Member Functions

static StreamScanner OpenFile (string path, int minBlockSize=0x10000, FileShare share=FileShare.Read)
 Opens a file and returns a StreamScanner representing it. More...
 

Protected fields

Stream _stream
 
bool _disposeStream
 

Member Function Documentation

static StreamScanner StreamScanner.OpenFile ( string  path,
int  minBlockSize = 0x10000,
FileShare  share = FileShare.Read 
)
inlinestatic

Opens a file and returns a StreamScanner representing it.

Property Documentation

int StreamScanner.MinBlockSize
getset

The minimum amount of data to read from the stream at once.

long StreamScanner.Position
getset

Gets or sets the stream's Position. If the stream is not seekable, the getter returns the position relative to the stream position when this object was constructed, and the setter cannot be used.