Property | Type | Description | |
---|---|---|---|
m_FileData | byte[] | ||
m_FileName | string |
Method | Description | |
---|---|---|
ByteReader ( string filename ) : System |
Constructor requires a file name
|
|
ByteReader ( string filename, |
Constructor requires a file name
|
|
ByteReader ( string filename, byte contents ) : System |
Constructor (used for tests) take spurious file name and pretends contents are the byte array
|
|
GetLookAheadSfmMarkerAndData ( string &sfmMarker, byte &sfmData, byte &sfmBadBytes ) : bool |
Return the next sfm marker and its data for view.
|
|
GetNextSfmMarkerAndData ( string &sfmMarker, byte &sfmData, byte &badSfmData ) : bool |
This is the public method that returns the 'next' marker and data and boolean as to the success of the operation. This method will return the look ahead values and then fetch the next ones. This supports the ability to look ahead a single sfm now for beter planning. (Possible enhancement would be to read the whole file in and store the infor in an internal structure, but that would lead to a duplication of memory - the contents being stored twice.) So, for now as it isn't needed, we'll just read ahead one token.
|
|
Rewind ( ) : void |
Method | Description | |
---|---|---|
InArray ( byte dataArray, byte data ) : bool |
Helper method to look through an array of bytes and return true if it's found
|
Method | Description | |
---|---|---|
BytesMatch ( byte readData, long readPos, byte searchData ) : bool |
Tests if the data bytes starting at the given position match the given search data.
|
|
CheckforAndHandleBOM ( ) : void |
This will look at the start of the file for the BOM and process it if it's found.
|
|
CopySpaceIfMatched ( byte readData, long &readPos, long limitPos, byte &writeData, long &writePos, byte searchData ) : bool |
Tests the given data at the given position for a match with given search data. If there is no match, or the match is at the end of the given data, the data is copied into a separate buffer. Otherwise, a space is copied over. This effectivly copies the given data to the output data, replacing matching searched-for data with a space, except at the end.
|
|
GetBytesUptoNextSfmMarker ( ) : byte[] |
Assumption ************************************************ All sfm markers are assumed to begin a new line, ie follow a newline, and begin with a backslash '\'. The following parsing code is based on this assumption. Assumption ************************************************
|
|
GetEOLForThisFile ( ) : byte[] |
Can't assume that it's a newline sequence, it could be a cr or lf or ?? Check the first XXXX bytes and see what the counts are for the characters and then determine the EOL.
|
|
Init ( string filename ) : void | ||
Init ( string filename, byte content ) : void | ||
IsCurrentData ( byte data ) : bool |
Search the m_FileData array at the current position and see if the passed in data is an exact match for that number of bytes.
|
|
getNextSfmMarkerAndData ( string &sfmMarker, byte &sfmData, byte &badSfmBytes ) : bool |
Worker method that returns the sfm marker as a string and the data for it as an array of bytes.
|
public ByteReader ( string filename ) : System | ||
filename | string | |
return | System |
public ByteReader ( string filename, |
||
filename | string | |
Log | ||
return | System |
public ByteReader ( string filename, byte contents ) : System | ||
filename | string | |
contents | byte | |
return | System |
public GetLookAheadSfmMarkerAndData ( string &sfmMarker, byte &sfmData, byte &sfmBadBytes ) : bool | ||
sfmMarker | string | |
sfmData | byte | |
sfmBadBytes | byte | |
return | bool |
public GetNextSfmMarkerAndData ( string &sfmMarker, byte &sfmData, byte &badSfmData ) : bool | ||
sfmMarker | string | |
sfmData | byte | |
badSfmData | byte | |
return | bool |
protected InArray ( byte dataArray, byte data ) : bool | ||
dataArray | byte | |
data | byte | |
return | bool |