WinDoc

Delve into the realm of Keyboards with our extensive coverage of news, reviews, and trends. From the...

using System;

namespace HelloWorld
{
  class Program
  {
    static void Main(string[] args)
    {
      Console.WriteLine("Hello World!");    
    }
  }
}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
procedure TMainForm.btTransferClick(Sender: TObject);
var ems1,ems2: 	TECLMemoryStream;
		tempStream:TMemoryStream;
begin
 lbSrcSize.Caption := IntToStr(Length(Memo1.Text));
 lbCompSize.Caption := '';
 // this procedure shouws how compressed data can be transmitted
 // lets prepare compressed data
 tempStream := TMemoryStream.Create;
 ems1 := TECLMemoryStream.Create('password', zlibFastest);
 Memo1.Lines.SaveToStream(ems1);
 // you can use CompressedDataStream for reading and writing compressed data
 // as any other stream (seek,read,write,LoadFromStream,SaveToStream)
 // here CompressedDataStream will be saved to tempStream
 ems1.CompressedDataStream.SaveToStream(tempStream);
 ems1.Free;
 // now we can transmit data from temp stream to another computer
 // ... transmitting tempStream ...

 // ... receiving tempStream ...
 // let's decompress data from tempStream
 ems2 := TECLMemoryStream.Create('password');
 // rewrite current empty compressed data with recieved data
 ems2.CompressedDataStream.LoadFromStream(tempStream);
 lbSrcSize.Caption := IntToStr(ems2.Size);
 lbCompSize.Caption := IntToStr(ems2.PackedSize);
 // decompress data
 Memo2.Lines.LoadFromStream(ems2);
 ems2.Free;
 tempStream.Free;
end;

https://windoc.fr/