Description |
The Byte Value is written to the current stream position. The stream position is updated accordingly.
|
|
Microsoft MSDN Links |
System.IO
System.IO.BufferedStream
|
|
|
A simple example |
program Project1;
{$APPTYPE CONSOLE}
uses
System.IO;
var
Memory : System.IO.MemoryStream;
Stream : System.IO.BufferedStream;
ByteAsInt : Integer;
begin
// Create our memory stream
Memory := System.IO.MemoryStream.Create;
// Create out BufferedStream to access this memory stream
Stream := System.IO.BufferedStream.Create(Memory);
// Read and write to the memory stream using the BufferedStream
Stream.WriteByte(1);
Stream.WriteByte(2);
Stream.WriteByte(3);
// Now seek to the start of the stream
Stream.Seek(0, SeekOrigin.Begin);
// Now display the contents
ByteAsInt := Stream.ReadByte;
while ByteAsInt > 0 do
begin
Console.WriteLine(ByteAsInt.ToString);
ByteAsInt := Stream.ReadByte;
end;
// Close the stream
Stream.Close;
Console.Readline;
end.
| Show full unit code | 1
2
3
|
|
|
|