У меня есть немного кода, который предполагается создать временный каталог во временном расположении файлов на системе:NIO Files.createTempDirectory на Windows, вызывает исключение
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()));
}
и
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;
}
Это является исключением:
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
Кто-нибудь знает, как я могу это сделать в ap независимый от латинской формы?