Last active
August 5, 2020 14:44
-
-
Save joakime/115050ecf66d78560c04fc401e791f94 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| On Unix / Linux | |
| path [/home/joakim/code/jetty/junk]./is/it/abs=/is/it/abs | |
| path [/home/joakim/code/jetty/junk].\is\it\abs=/home/joakim/code/jetty/junk/\is\it\abs | |
| path [/home/joakim/code/jetty/junk].\\ceres\joakim\abs=/home/joakim/code/jetty/junk/\\ceres\joakim\abs | |
| path [/home/joakim/code/jetty/junk].D:\is\it\abs=/home/joakim/code/jetty/junk/D:\is\it\abs | |
| On Windows | |
| path [C:\Code\Junk]./is/it/abs=C:\is\it\abs | |
| path [C:\Code\Junk].\is\it\abs=C:\is\it\abs | |
| path [C:\Code\Junk].\\ceres\joakim\abs=\\ceres\joakim\abs | |
| path [C:\Code\Junk].D:\is\it\abs=D:\is\it\abs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package fs; | |
| import java.nio.file.Path; | |
| import java.nio.file.Paths; | |
| public class ServletApiExample | |
| { | |
| public static void main(String[] args) | |
| { | |
| Path multipartLocation = Paths.get(System.getProperty("user.dir")); | |
| getPart(multipartLocation, "/is/it/abs"); | |
| getPart(multipartLocation, "\\is\\it\\abs"); | |
| getPart(multipartLocation, "\\\\ceres\\joakim\\abs"); | |
| getPart(multipartLocation, "D:\\is\\it\\abs"); | |
| } | |
| private static void getPart(Path multipartLocation, String partLocation) | |
| { | |
| Path path = multipartLocation.resolve(partLocation); | |
| System.out.printf("path [%s].%s=%s%n", multipartLocation, partLocation, path); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment