Here you can find the source of canWrite(Path path)
public static boolean canWrite(Path path)
//package com.java2s; //License from project: Apache License import java.nio.file.Files; import java.nio.file.LinkOption; import java.nio.file.Path; public class Main { public static boolean canWrite(Path path) { if (!isFile(path)) { return false; }/*from w w w .j ava 2s . c o m*/ try { //## todo: find a better way, Files.isWritable() does not work e.g., returns true for ZipPath, which is wrong return path.toFile().canWrite(); } catch (UnsupportedOperationException e) { return false; } } public static boolean isFile(Path path, LinkOption... options) { return Files.isRegularFile(path, options); } }