Bug 162954 - [api] Provide an InputStream and OutputStream from IFileService
Summary: [api] Provide an InputStream and OutputStream from IFileService
Status: RESOLVED FIXED
Alias: None
Product: Target Management
Classification: Tools
Component: RSE (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 2.0   Edit
Assignee: Kushal Munir CLA
QA Contact: Martin Oberhuber CLA
URL:
Whiteboard:
Keywords: api
Depends on:
Blocks: 170916 170926
  Show dependency tree
 
Reported: 2006-10-31 12:36 EST by Lothar Werzinger CLA
Modified: 2008-08-13 13:17 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lothar Werzinger CLA 2006-10-31 12:36:29 EST
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?
Comment 1 Martin Oberhuber CLA 2006-10-31 12:41:12 EST
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.
Comment 2 Lothar Werzinger CLA 2006-10-31 12:45:40 EST
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.
Comment 3 Martin Oberhuber CLA 2006-10-31 12:57:45 EST
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.
Comment 4 Martin Oberhuber CLA 2006-11-08 03:48:07 EST
Discuss after 1.0
Comment 5 Martin Oberhuber CLA 2007-01-18 10:43:12 EST
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.
Comment 6 Kushal Munir CLA 2007-02-19 23:22:57 EST
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. 
Comment 7 Kushal Munir CLA 2007-03-28 16:22:20 EDT
Complete.
Comment 8 Martin Oberhuber CLA 2008-08-13 13:17:43 EDT
[target cleanup] 2.0 M6 was the original target milestone for this bug