In Java8, I needed a Path class to get the file path, but I wrote a memo because there was a situation where Strings were mixed during processing and I had to convert them one by one.
In conclusion, if you pass a String string as an argument with the resolve method of the Path class, you can recognize the entire path as a Path type.
Reference site: Path (Java Platform SE 8) https://docs.oracle.com/javase/jp/8/docs/api/java/nio/file/Path.html
The entire file path can be set with the arguments specified by the resolve method added.
Specific example: Path specified by Path type → / test / pathTest Path you want to add with String → hoge.txt
Result: Result of using resolve method → /test/pathTest/hoge.txt
I would appreciate it if you could tell me if the interpretation was different or if there is an easier way.
Recommended Posts