Replace java.nio.file

I am using Android studio 2.3.1 and JDK 1.8.0 for this project

I imported a project that uses "Java. NiO. File. Files" and "Java. NiO. File. Paths"

The package "Java. NiO. File" does not exist in Java 8

In addition, Android studio does not allow you to select JDK 1.7

What can I do with this code?

public void toFile(final String path) throws IOException {
    Files.write(Paths.get(path), toBuffer());
}

And this code

public static Source fromFile(final String path) throws IOException {
    return fromBuffer(Files.readAllBytes(Paths.get(path)));
}

**(unable to resolve file and path)

thank you

resolvent:

Good news: Java. NiO. * is now part of Android o!

More information here https://developer.android.com/reference/java/nio/package-summary.html

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>