You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by manco <me...@yahoo.com> on 2005/05/26 23:41:03 UTC

[VFS] can I do a remote file append?

Hi all,
 
I set up a nice little package that I can use to transfer files between locations, 
based on an xml config file. I still have a few bugs with connecting to some sftp sites
but other than that is works quite nicely.
 
However now I have a new requirement, append to a remote file.
I just went down the path of doing this in 3 steps, first copy/move the remote file
to my local filesystem. Second, open the file in append mode and append data from
zero or more local files, (not sure which is better, FileChannels or streams here) close
the file. Lastly copy/move the file back to the original remote location.
 
Then I saw in the VFS javadoc
  FileObject.getFileContent().getOuputStream(boolean Append) ...
 
Is there some combination of FileContent that I can use to do a "remote" append, for 
sftp, ftp, smb and file?
 
Thanks,
Manco

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Re: [VFS] can I do a remote file append?

Posted by Mario Ivankovits <Ma...@ops.co.at>.
Am Do 26.05.2005 23:41 schrieb manco <me...@yahoo.com>:

> Then I saw in the VFS javadoc
>   FileObject.getFileContent().getOuputStream(boolean Append) ...
>  
> Is there some combination of FileContent that I can use to do a
> "remote" append, for
> sftp, ftp, smb and file?

If the filesystem do have the capability Capability.APPEND_CONTENT it is
possible to directly open the remote file in "append mode".
However, the input stream used to read the file and the output stream to
append to the file is always routed through your JVM.
VFS do not provide a method to do this completley remote.

However, if you use the append mode you avoid to copy the file around.
If a filesystem do not provide this capability you have to fallback to
your solution.

---
Mario


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org