[英]How to access files from shared location using java 8 or any recent ways to access using java?
I have found how to access but these links are old, one of the link is我找到了如何访问,但这些链接是旧的,其中一个链接是
How to Read file from a shared location Windows? 如何从共享位置 Windows 读取文件? (Java) (爪哇)
All I want is some recent way to do it if possible.如果可能的话,我想要的只是一些最近的方法。
It is easy by using new nio2 package, ie Path使用新的 nio2 package 很容易,即路径
Path path = Paths.get("src/test/resources/fileTest.txt");
String read = Files.readAllLines(path).get(0);
Of coz you can retrieve file name, path, location by its API.因为您可以通过其 API 检索文件名、路径、位置。 hope it solved your problem希望它解决了你的问题
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.