[truezip-users] Re: Issue in copying files into existing archive using Path
- From: Christian Schlichtherle <christian@...>
- To: users@...
- Subject: [truezip-users] Re: Issue in copying files into existing archive using Path
- Date: Thu, 4 Jul 2013 16:43:42 +0200
I finally came round to look into this. Here are my findings:
First, I cannot reproduce your issue: I run your code on Mac OS X, so I had
to change the input path name from "C:\\test\\1.txt" to "1.txt" (using the
current directory). With this change, I could successfully write "1.txt" and
"2.txt" to the archive file.
The exception that you've seen is almost certainly a side effect of something
else. The Windows file system is a bitch. If you happen to access the archive
file in any way (even when just listing it in the Windows explorer), then the
OS may lock it for concurrent writing and this is why you get an
Next, note that there are several layers of file systems in TrueZIP/TrueVFS.
The FsReadOnlyArchiveFileSystemException is from the TrueZIP Kernel. The
TFileSystem class does not have direct access to it. Hence,
TFileSystem.isReadOnly() is just a stub which always returns false, even when
using a read-only archive driver. Maybe this should get improved, but at
least it's documented in the Javadocs.
Next, although the code works, it will not use the GROW mode. You have to
change the following line:
Finally, you don't have to use TFileSystem at all. It primarily exists to
satisfy the contract of the java.nio.file package. In fact, you can simplify
your code to:
TConfig current = TConfig.get();
TArchiveDetector tArchiveDetector = new TArchiveDetector("xyz", new
TPath archive = new TPath("test.xyz");
TPath entry = new TPath("2.txt");
Hope this helps.