[This is preliminary documentation and is subject to change.]

Replaces given ammount of bytes in Stream with another amount of bytes

Namespace: Tools.IOt
Assembly: Tools (in Tools.dll) Version: 1.5.3.38916 (1.5.3.38916)

Syntax

C#
public static void InsertInto(
	this Stream Stream,
	int Position,
	int BytesToReplace,
	byte[] Data,
	int Chunk
)
Visual Basic
<ExtensionAttribute> _
Public Shared Sub InsertInto ( _
	Stream As Stream, _
	Position As Integer, _
	BytesToReplace As Integer, _
	Data As Byte(), _
	Chunk As Integer _
)
Visual C++
[ExtensionAttribute]
public:
static void InsertInto(
	Stream^ Stream, 
	int Position, 
	int BytesToReplace, 
	array<unsigned char>^ Data, 
	int Chunk
)
F#
static member InsertInto : 
        Stream:Stream * 
        Position:int * 
        BytesToReplace:int * 
        Data:byte[] * 
        Chunk:int -> unit 
JScript
public static function InsertInto(
	Stream : Stream, 
	Position : int, 
	BytesToReplace : int, 
	Data : byte[], 
	Chunk : int
)

Parameters

Stream
Type: System.IO..::..Stream
Stream to perform operation on. It must support seking, reading and writing
Position
Type: System..::..Int32
Position where bytes to be replaced starts
BytesToReplace
Type: System..::..Int32
Number of bytes currently in stream to be replaced (can be 0)
Data
Type: array<System..::..Byte>[]()[][]
Bytes to replace old bytes with
Chunk
Type: System..::..Int32
when data are moved from one part of stream to another they are moved in chunks. This defines size of chunk in bytes. Befault is 1024.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Stream. When you use instance method syntax to call this method, omit the first parameter. For more information, see or .

Remarks

If Data's lenght does not match BytesToReplace the stream is shortened or enlarged and data after replaced block are moved as necessary

Exceptions

ExceptionCondition
System.IO..::..IOExceptionAn IO error occurs
System..::..ObjectDisposedExceptionStream is closed
System..::..NotSupportedExceptionStream does not support seeking -or- Stream does not support writing -or- Stream does not suport reading
System..::..ArgumentNullExceptionStream is null -or- Data is null
System..::..ArgumentOutOfRangeExceptionPosition is not within range <0; Stream.Length) -or- BytesToReplace is not within range <0; Stream.Lenght - Position - or- Chunk is not positive

See Also

Collapse/expand Version History

1.5.3