The original name of file is 1_00100 0042.jpg
. I have a problem:
java.net.URISyntaxException: Illegal character in path at index 49: file:///opt/storage/user-data/attachments/1_00100\ 0042.jpg
Can you give me some solutions how to get this file using this bad path? I know that C# have Path class. Is there something similar in Java?
I tried to do next but not successfully:
private String replaceWhitespace(String str) {
if (str.contains(" ")) {
str = str.replace(" ", "%20");
}
return str;
}