When I use ResourceLoader class of spring to load file which can have encoded value in the file name (like %27 for ' or %20 for space) and call getFile() method on it, it is converting the encoded value into normal value (in this case %27 to ' or %20 into space), because of this whenever I use that file object to check if that file exists in the file system or try to write something to that file, it is failing due to the fact that there is no file with that decoded name in the file system. How can we preserve the decoded file name while using ResouceLoader class of Spring.
String filename = "sample%27name%20ofmyfile.txt";
Resource resource= resourceLoader.getResource(filename);
File file = resource.getFile(); //This is representing the file name as "sample'name ofmyfile.txt" and subsequent file operations are failing because there is no file with this decoded name