Re: Appending data to file in a MemoryFileSystem.

2019-09-19 Thread Richard Linsdale
Neil, thanks for suggestion, less work and much tidier code than my original fall back thoughts.  Implemention done and passing the unit tests! Richard On 19/09/2019 15:25, Neil C Smith wrote: On Thu, 19 Sep 2019 at 15:04, Richard Linsdale wrote: Any suggestions welcome, as I want to avoid c

Re: Appending data to file in a MemoryFileSystem.

2019-09-19 Thread William Reynolds
But can't you construct a FileChannel from the FileOutputStream? I thought the question was how to seek on an output stream, which the example generates. On 9/19/2019 10:06 AM, Neil C Smith wrote: On Thu, 19 Sep 2019 at 17:03, William Reynolds wrote: From https://stackoverflow.com/questions

Re: Appending data to file in a MemoryFileSystem.

2019-09-19 Thread Neil C Smith
On Thu, 19 Sep 2019 at 17:03, William Reynolds wrote: > > From https://stackoverflow.com/questions/9558979/java-outputstream-skip-offset ... >FileOutputStream out = new FileOutputStream(file); There is no File! ;-) Best wishes, Neil -

Re: Appending data to file in a MemoryFileSystem.

2019-09-19 Thread William Reynolds
From https://stackoverflow.com/questions/9558979/java-outputstream-skip-offset |try{FileOutputStreamout =newFileOutputStream(file);try{FileChannelch =out.getChannel();ch.position(offset);ch.write(ByteBuffer.wrap(data));}finally{out.close();}}catch(IOExceptionex){// handle error}| On 9/19/2

Re: Appending data to file in a MemoryFileSystem.

2019-09-19 Thread Neil C Smith
On Thu, 19 Sep 2019 at 15:04, Richard Linsdale wrote: > Any suggestions welcome, as I want to avoid copying the existing file > content to a new file on every append request and then renaming the file > (which is my probably short term fall back). The MemoryFileSystem is quite simple, and everyth