Community
Participate
Working Groups
There is no easy way to just get the contents of a remote file (e.g. as an InputStream). At least I didn't find it. I had to download the remote file to a temporary file. That proved to be very hard, as I had to come up with a (valid) temporary filename and location, as well as the cleanup. RSE has all the infrastructure already in place (you can open a remote file in an editor), so why not offer it as part of IFileService?
I think that one option of getting an InputStream would be using the (currently experimental) RSE EFS provider, through the Eclipse Filesystem APIs. This doesn't work correctly right now, but this would be the kind of wrapper around the RSE caching mechanism that you are looking for. Another option might be to enhance the IFileService API to deal with streams rather than temp files.
I think it should be part of the basic IFileService API. Otherwise it will be cumbersome to use, as one would have to use an IFileService for certain operations and an EFS provider for other operations.
I agree... it would also make IFileService more versatile, since (depending on the provider) a method providing a Stream could allow access to really large remote objects without downloading them completely.
Discuss after 1.0
Even if some implementors should not be capable of returning a stream directly (so they have to download the full file and then return a stream to it), our API should provide means for optimized services. One use case is a 4GB video file on a remote server, where one is only interested in the first few KB in order to understand some basic properties of the video stream. This is especially important for content type matching, and EFS. The IFileService API should thus be extended to provide methods for upload and download through streams.
I'm changing the title of the bug to indicate that an input stream and output stream is required from a file service. I've added two methods getInputStream() and getOutputStream() to IFileService which will respectively return an input stream to read in contents of remote files and an output stream to write to a remote file. Implementation for SSH, FTP and Local are complete.
Complete.
[target cleanup] 2.0 M6 was the original target milestone for this bug