C# Класс SIL.FieldWorks.FDO.Infrastructure.Impl.ElementReader

Responsible to read a file which has a sequence of similar elements and pass a byte array of each element to a delgate for processing. Use low-level byte array methods, overlapping file read with parsing the file and calling the delegate. The expectation is that, after some unspecified header material, the file consists of a sequence of elements, all with the same tag (e.g., "rt" elements in FieldWorks XML backend). Following the last we expect a close tag for the containing element, e.g., "/languageProjet" in Fieldworks. These two tags can be configured so the class can be used in other ways. Enhance JohnT: Experiments on Websters indicate we're spending appreciable time on the parsing and calling the delegate. We could potentially do the parsing and delegate calling on different threads, perhaps even (since the order of calling delegates on different elements does not matter) split the parsing over multiple threads.
Наследование: IDisposable
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
Dispose ( ) : void
ElementReader ( string openingMarker, string finalClosingTag, string pathname, Action outputHandler ) : System
Run ( ) : void

Защищенные методы

Метод Описание
Dispose ( bool fDisposing ) : void

Приватные методы

Метод Описание
AdvanceToMarkerElement ( ) : bool

Advance input, copying characters read to m_output if it is non-null, until we have successfully read the target marker, or reached EOF. Return true if we found it. Assumes m_marker is at least two characters. Also expects it to be an XML element marker, or at least that it's first character does not recur in the marker.

ElementReader ( string openingMarker, string finalClosingTag, string pathname, Action outputHandler, int bufferSize ) : System
EndMarkerFound ( ) : bool
FillBuffer ( ) : void

Get some more data to process. Initially, buffer[m_nextReadBuffer] is in state non-in-use, and we initiate a read into it. After that, we should typically find that buffer[m_nextReadBuffer] is in state being-read, and we wait for that read to finish. Then we initiate a new read on the next buffer, asssuming it is not in use.

GetRtElement ( ) : bool

Called when we have just read the input marker. Advances to the start of closing tag or just after the next element.

More ( ) : bool
NextBuffer ( int bufIndex ) : int
StartReadingBuffer ( ) : void

Описание методов

Dispose() публичный метод

public Dispose ( ) : void
Результат void

Dispose() защищенный метод

protected Dispose ( bool fDisposing ) : void
fDisposing bool
Результат void

ElementReader() публичный метод

public ElementReader ( string openingMarker, string finalClosingTag, string pathname, Action outputHandler ) : System
openingMarker string
finalClosingTag string
pathname string
outputHandler Action
Результат System

Run() публичный метод

public Run ( ) : void
Результат void