BinaryStreamBaseRemoveBytes Method

Removes a certain number of bytes from the stream, shifting valid data after this location to the left. The stream's position remains unchanged. (i.e., pointing to where the data used to exist).

Definition

Namespace: SnapDB.IO
Assembly: SnapDB (in SnapDB.dll) Version: 1.0.102.0 -- Release Build+29075351d0e5aa4dea46a5c520805222f672dc2e
public void RemoveBytes(
	int numberOfBytes,
	int lengthOfValidDataToShift
)

Parameters

numberOfBytes  Int32
The distance to shift. Positive means shifting to the right (i.e., inserting data) Negative means shift to the left (i.e., deleting data)
lengthOfValidDataToShift  Int32
The number of bytes that will need to be shifted to perform the remove. This only includes the data that is valid after the shift is complete, and not the data that will be removed.

Remarks

Internally this function merely accomplishes an Array.Copy(stream,position+numberOfBytes,stream,position,lengthOfValidDataToShift) However, it's much more complicated than this. So this is a pretty useful function. The space at the end of the copy is uninitialized.

See Also