TsgcWebSocketFirewall › Methods › SaveBansToStream
Serializes the active ban list into any writable TStream, useful for persistence backends that are not file-based (databases, network sync, encrypted archives).
procedure SaveBansToStream(aStream: TStream);
| Name | Type | Description |
|---|---|---|
aStream | TStream | Writable destination stream; data is appended at the current Position and Position is advanced past the written block. |
The produced layout is identical to SaveBansToFile and can therefore be round-tripped through LoadBansFromStream. Only active bans are written; expired entries are filtered out at serialization time. Call Seek(0, soBeginning) on the stream before reading it back.
var
oStream: TMemoryStream;
begin
oStream := TMemoryStream.Create;
try
sgcWebSocketFirewall1.SaveBansToStream(oStream);
oStream.SaveToFile('bans.dat');
finally
oStream.Free;
end;
end;