Questions tagged [tstream]
26 questions
30
votes
1 answer
Opening a TStream on stdin/stdout in a Delphi console app
I'm trying to write a Delphi console application that creates a TStream for its standard input, and another TStream for its standard output.
(It will be launched by a host app with its input and output redirected to pipes, and will be passing binary…

Joe White
- 94,807
- 60
- 220
- 330
8
votes
2 answers
TFileStream with offset
I need to extend TFileStream so that it can work with a file not from 0 offset, but from user defined offset. I mean it must interpret user defined offset as stream beginning. My code is:
type
TSuFileStream = class(TFileStream)
protected
…

JuniorD
- 83
- 3
7
votes
4 answers
String to TStream
I'm attempting to convert a string to a TStream. My code below gives me an "Abstract Error" message on the CopyFrom line. I'm against a brick wall here, any ideas on how to solve this?
procedure StringToStream(const AString: string; out AStream:…

Greg Bishop
- 517
- 1
- 5
- 16
4
votes
1 answer
Delphi tstream: strange behaviour on create
I am new of Delphi. In the documentation of TStrem class, i read it is an abstract class.
So i think the compiler goes in error when i try to create it with
stream := TStream.Create();
Why not?

user3083618
- 270
- 1
- 4
- 16
4
votes
5 answers
How can I descend from both TFileStream and TMemoryStream?
I have a class that inherits from TFileStream and a class that inherits from TMemoryStream. Both implement exactly the same functions to do with reading data eg:
TCustomFileStream = class (TFileStream)
function ReadByte: byte;
function ReadWord:…

Bennyboy
- 75
- 3
4
votes
1 answer
How to load a stream with a file copied in Windows clipboard
I've copied a file into the Windows clipboard (By simply clicking right, copy).
I would like to load a TStream descendant with the file currently stored in the clipboard.
uses
Classes, Clipbrd;
MyStream := TMemoryStream.Create;
try
//here I…

Fabrizio
- 7,603
- 6
- 44
- 104
4
votes
2 answers
What are the underlying Read/Write methods for Streams in Delphi XE3
I have some derived Stream classes for older versions of RADStudio that just reimplement the Read,Write,Seek methods, and the Size and Position properties.
I'm looking to port these to XE3, but I see that there are now (for example) three overloads…

Roddy
- 66,617
- 42
- 165
- 277
3
votes
1 answer
TStream warning in delphi
I have the following code snippet
Procedure TFrm.Retrieve(mystring : string);
var
bs : TStream;
...
begin
...
bs:=nil;
//bs:= TStream.create;
try
bs := CreateBlobStream(FieldByName('Picture'), bmRead);
finally
…

Shirish11
- 1,587
- 5
- 17
- 39
3
votes
2 answers
TStream as an object inside StringList
I am using Delphi 7 and playing with a StringList, with TStream as object.
My test project has a ListBox, a Memo and 2 buttons (Add and Remove).
Here is what I got so far:
var
List: TStringList;
procedure TForm1.FormCreate(Sender:…

Guybrush
- 1,575
- 2
- 27
- 51
2
votes
1 answer
Delphi - writing a large dynamic array to disk using stream
In a Delphi program, I have a dynamic array with 4,000,000,001 cardinals. I'm trying to write (and later read) it do a drive. I used the following:
const Billion = 1000000000;
stream := tFileStream.Create( 'f:\data\BigList.data',…

Jud McCranie
- 58
- 9
2
votes
0 answers
Random delay when using TStream for reading custom stream from http server
I am using TIdHttp (from Indy components) for connecting to a camera that supports Sony Remote Api. The camera sends live view stream to an http connection as a response of an HTTP GET command. I wrote a TStream subclass and used it as a streaming…

Hossein
- 23
- 5
1
vote
1 answer
Getting spaces after upgrading from Indy 9 on Delphi 6 to Indy 10 on Delphi 11
I have migrated from Delphi 6 to Delphi 11 (64 bit edition) and in that I'm using the Indy and ZLib components. I have migrated from Indy 9 to Indy 10, using the component to post API and before that I'm writing the String to a Stream via:
var
…

sn_na_v
- 31
- 5
1
vote
0 answers
How to force a DataSnap REST TStream method to respond as content stream instead of a JSON Array
I've a DataSnap REST method returning files as TStream.
The client side is Objective-C code on iOS, JavaScript code, and Delphi code.
I compiled the server side with Delphi Sydney 10.4.1, upgrading from Delphi XE3.
Testing the new version, I…

Giorgio Calzolato
- 379
- 4
- 15
1
vote
0 answers
Http response: Cannot convert JSON into stream
I have an API in JAVA to upload a zip file to a server in Delphi, and I am doing it as follows:
DSRESTConnection conn = new DSRESTConnection();
conn.setHost("example.com");
conn.setPort(8080);
TServerMethods1 proxy =…

msc87
- 943
- 3
- 17
- 39
1
vote
1 answer
DataSnap REST JavaScript client-side – How to show pdf file data returned as TStream from a TServerMethods method
I've a DataSnap server method
function TServerMethods.GetFile(filename): TStream
returning a file.
In my test case the file is a simple .PDF.
I'm sure this function works fine, as I'm able to open files on ObjectiveC client side app's where I've…

Giorgio Calzolato
- 379
- 4
- 15