I would like to use Apache Commons VFS to append text to a file if the file already exists and create a new file containing the text if the file does not exist.
Looking at the Javadoc for VFS it appears that getOutputStream(boolean bAppend) method in the FileContent class will do the job but after a fairly extensive Google search I cannot figure out how to use getOutputStream to append text to a file.
The filesystem I will be using with VFS is either a local file (file://) or CIFS (smb://).
The reason for using VFS is the program I'm working on needs to be able to write to a CIFS share using a specific username/password which is different to the user executing the program and I want the flexibility to write to the local filesystem or a share hence why I'm not just using JCIFS.
If anyone can point me in the right direction or provide a snippet of code I would be very grateful.