In order to work with Jaxb, I need to have a normal java.io.File
Object. As I do not want to have legacy code in a quite new project, I want to use java.nio.file.Path
objects.
As gradle resolves dependencies in jar
files, I need to handle them as com.sun.nio.zipfs.ZipPath
. Now the thing is, that I am using these files only for codegeneration, and do not necessarily want to unpack them.
Unfortunately, the ZipPath.toFile()
method throws an UnsupportedOperationException
, so I cannot convert the Path to a File, which is necessary in order to use the JaxbUnmarshaller
, to validate the correct layout of the file and to convert it into an actual runtime object.
I tried:
- ZipPath.toFile(); resulted in error
- Paths.get(ZipPath.toUri()).toFile(); resulted in error as the result is a ZipPath again
How can I get a File from a ZipPath without unzipping it?
I suppose it is possible via the ZipFileSystem, but I dont get it.