ich ein Stück Code haben, der ein temporäres Verzeichnis in dem temporären Speicherort der Datei auf dem System erstellen angenommen hat:NIO Files.createTempDirectory auf Windows verursacht Ausnahme
try {
Path tempdir = Files.createTempDirectory("tempmm");
tempdir.toFile().deleteOnExit();
tempFilename = format("%s/%s.zip", tempdir, meetId);
// Handle windows
//tempFilename = tempFilename.replace("\\", "/");
uri = URI.create("jar:file:" + tempFilename);
System.out.println("temp file uri = " + uri.toString());
} catch (IOException e) {
log.severe(format("Unable to create temporary directory: %s", e.toString()));
}
und
try (FileSystem zipfs = FileSystems.newFileSystem(uri, new HashMap<String, String>() {{ put("create", "true"); }})) {
Path externalMMFile = Paths.get(filePath);
Path pathInZipfile = zipfs.getPath(externalMMFile.getFileName().toString());
// copy Meet Manager Database file into the zip file
Files.copy(externalMMFile,pathInZipfile, StandardCopyOption.REPLACE_EXISTING);
} catch (IOException e) {
log.severe("Unable to create zip upload file!");
System.out.println(e.toString());
return false;
}
Dies ist die Ausnahme, die auftritt:
java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Ill
egal character in opaque part at index 11: jar:file:C:\DOCUME~1\David\LOCALS~1\T
emp\tempmm6286934818003944424/107.zip
java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Ill
egal character in opaque part at index 11: jar:file:C:\DOCUME~1\David\LOCALS~1\T
emp\tempmm6286934818003944424/107.zip
Hat jemand eine Idee, wie ich dies in ap tun kann latform-unabhängige Weise?