Currently rxftp.cls only accepts filenames as input/output, making it dependent on .stream objects as i/o method. I propose that the code be changed to become sensitive to the type of object that the caller provides as input and output in get and put operations: if either of these parameters is not a string object, it should be assumed to be an object of a class that supports a get or a put method. This lets us use other media then .stream objects to send and receive data over ftp.
Anonymous
The use of GET and PUT is not actually a correct implementation as I suggested, instead the following is a working example of this proposal:
To make this work rxFtp.cls could be changed to replace all floc = .stream~new(flocal) stmts with:
if flocal~isA(.String) then
floc = .Stream~new(flocal)
else
floc = flocal
To receive a file over FTP without creating a result file:
recvr = .Recvr~new
retc = myftp~FtpGet(recvr, "remote.file", "ASCII")
To extract the received data:
loop line over recvr~allitems
say line
end
Here is the recvr class:
::class recvr subclass queue
::attribute receivedData
::method open
self~receivedData = ""
return "READY:"
::method charout
self~receivedData ||= arg(1)
return 0
::method close
self~empty
loop line over self~receivedData~makeArray(x'0d0a')
self~queue(line)
end
return "READY:"
A similar class can be used to send data over ftp without using a local file as source.
There really is no reason to do this. It is the File Transfer Protocol application after all.
In fact, this is the perfect place for a developer to subclass the ftp class and perform this kind of transformation. It make more sense to subclass it rather that change an expected behaviour.
David, I started off trying to subclass this class, but I quickly found
that I had to move most of the logic into the subclass to make it work. In
addition, some of the methods are defined with the private attribute so
they cannot be called from a subclass. If you can show me a simple way to
subclass this class in a way that provides the functionality that I need it
would be very much appreciated.
Thanks,
Staffan
On Mon, Mar 31, 2014 at 3:18 PM, David Ashley wdashley@users.sf.net wrote:
Related
Feature Requests:
#592And one more thing: my proposed change would NOT change the current
behaviour of rxftp as per your comment, any existing programs would work
without changes. The result would just make rxftp more flexible.
Staffan
On Mon, Mar 31, 2014 at 3:39 PM, Staffan Tylen staffan.tylen@gmail.comwrote:
Related
Feature Requests:
#592