Lines Matching refs:path

64     private static FileSystemProvider provider(Path path) {
65 return path.getFileSystem().provider();
85 * @param path
86 * the path to the file to open
103 public static InputStream newInputStream(Path path, OpenOption... options)
106 return provider(path).newInputStream(path, options);
130 * Path path = ...
134 * OutputStream out = Files.newOutputStream(path);
137 * out = Files.newOutputStream(path, APPEND);
140 * out = Files.newOutputStream(path, CREATE, APPEND);
143 * out = Files.newOutputStream(path, CREATE_NEW);
146 * @param path
147 * the path to the file to open or create
167 public static OutputStream newOutputStream(Path path, OpenOption... options)
170 return provider(path).newOutputStream(path, options);
262 * Path path = ...
265 * ReadableByteChannel rbc = Files.newByteChannel(path, EnumSet.of(READ)));
269 * WritableByteChannel wbc = Files.newByteChannel(path, EnumSet.of(CREATE,APPEND));
273 * SeekableByteChannel sbc = Files.newByteChannel(path, EnumSet.of(CREATE_NEW,READ,WRITE), perms);
276 * @param path
277 * the path to the file to open or create
300 * method is invoked to check read access to the path if the file is
302 * checkWrite} method is invoked to check write access to the path
310 public static SeekableByteChannel newByteChannel(Path path,
315 return provider(path).newByteChannel(path, options, attrs);
326 * @param path
327 * the path to the file to open or create
346 * method is invoked to check read access to the path if the file is
348 * checkWrite} method is invoked to check write access to the path
356 public static SeekableByteChannel newByteChannel(Path path, OpenOption... options)
361 return newByteChannel(path, set);
394 * the path to the directory
445 * the path to the directory
523 * the path to the directory
560 * @param path
561 * the path to the file to create
581 public static Path createFile(Path path, FileAttribute<?>... attrs)
586 newByteChannel(path, options, attrs).close();
587 return path;
670 * dir} is not an absolute path then its {@link Path#toAbsolutePath
671 * toAbsolutePath} may need to be invoked to get its absolute path.
693 // don't have permission to get absolute path
770 * the path to directory in which to create the file
781 * @return the path to the newly created file that did not exist before
826 * @return the path to the newly created file that did not exist before
872 * the path to directory in which to create the directory
880 * @return the path to the newly created directory that did not exist before
921 * @return the path to the newly created directory that did not exist before
949 * {@link Path#isAbsolute absolute} or relative path and may not exist. When
950 * the target is a relative path then file system operations on the resulting
951 * link are relative to the path of the link.
966 * the path of the symbolic link to create
973 * @return the path to the symbolic link
988 * method denies write access to the path of the symbolic link.
1003 * The {@code existing} parameter is the path to an existing file. This
1005 * accessed using {@code link} as the path. On some file systems this is
1017 * a path to an existing file
1019 * @return the path to the link (directory entry)
1060 * @param path
1061 * the path to the file to delete
1076 public static void delete(Path path) throws IOException {
1077 provider(path).delete(path);
1097 * @param path
1098 * the path to the file to delete
1115 public static boolean deleteIfExists(Path path) throws IOException {
1116 return provider(path).deleteIfExists(path);
1189 * the path to the file to copy
1191 * the path to the target file (may be associated with a different
1192 * provider to the source path)
1196 * @return the path to the target file
1309 * the path to the file to move
1311 * the path to the target file (may be associated with a different
1312 * provider to the source path)
1316 * @return the path to the target file
1365 * the path to the symbolic link
1396 * @param path
1397 * the path to the file
1410 public static FileStore getFileStore(Path path) throws IOException {
1411 return provider(path).getFileStore(path);
1437 * @param path
1438 * one path to the file
1440 * the other path
1453 public static boolean isSameFile(Path path, Path path2) throws IOException {
1454 return provider(path).isSameFile(path, path2);
1468 * @param path
1469 * the path to the file to test
1480 public static boolean isHidden(Path path) throws IOException {
1481 return provider(path).isHidden(path);
1534 * by placing them in a JAR file on the application class path or in the
1551 * @param path
1552 * the path to the file to probe
1563 public static String probeContentType(Path path)
1568 String result = detector.probeContentType(path);
1574 return FileTypeDetectors.defaultFileTypeDetector.probeContentType(path);
1601 * Path path = ...
1602 * AclFileAttributeView view = Files.getFileAttributeView(path, AclFileAttributeView.class);
1610 * @param path
1611 * the path to the file
1620 public static <V extends FileAttributeView> V getFileAttributeView(Path path,
1624 return provider(path).getFileAttributeView(path, type, options);
1649 * Path path = ...
1650 * BasicFileAttributes attrs = Files.readAttributes(path, BasicFileAttributes.class);
1655 * PosixFileAttributes attrs = Files.readAttributes(path, PosixFileAttributes.class, NOFOLLOW_LINKS);
1658 * @param path
1659 * the path to the file
1679 public static <A extends BasicFileAttributes> A readAttributes(Path path,
1684 return provider(path).readAttributes(path, type, options);
1714 * Path path = ...
1715 * Files.setAttribute(path, "dos:hidden", true);
1718 * @param path
1719 * the path to the file
1727 * @return the {@code path} parameter
1748 public static Path setAttribute(Path path, String attribute, Object value,
1752 provider(path).setAttribute(path, attribute, value, options);
1753 return path;
1783 * Path path = ...
1784 * int uid = (Integer)Files.getAttribute(path, "unix:uid");
1787 * @param path
1788 * the path to the file
1809 public static Object getAttribute(Path path, String attribute,
1816 Map<String,Object> map = readAttributes(path, attribute, options);
1883 * @param path
1884 * the path to the file
1907 public static Map<String,Object> readAttributes(Path path, String attributes,
1911 return provider(path).readAttributes(path, attributes, options);
1917 * <p> The {@code path} parameter is associated with a {@code FileSystem}
1929 * @param path
1930 * the path to the file
1947 public static Set<PosixFilePermission> getPosixFilePermissions(Path path,
1951 return readAttributes(path, PosixFileAttributes.class, options).permissions();
1957 * <p> The {@code path} parameter is associated with a {@code FileSystem}
1963 * @param path
1982 public static Path setPosixFilePermissions(Path path,
1987 getFileAttributeView(path, PosixFileAttributeView.class);
1991 return path;
1997 * <p> The {@code path} parameter is associated with a file system that
2001 * @param path
2019 public static UserPrincipal getOwner(Path path, LinkOption... options) throws IOException {
2021 getFileAttributeView(path, FileOwnerAttributeView.class, options);
2030 * <p> The {@code path} parameter is associated with a file system that
2037 * Path path = ...
2039 * provider(path).getUserPrincipalLookupService();
2041 * Files.setOwner(path, joe);
2044 * @param path
2063 public static Path setOwner(Path path, UserPrincipal owner)
2067 getFileAttributeView(path, FileOwnerAttributeView.class);
2071 return path;
2092 public static boolean isSymbolicLink(Path path) {
2094 return readAttributes(path,
2117 * @param path
2118 * the path to the file to test
2131 public static boolean isDirectory(Path path, LinkOption... options) {
2133 return readAttributes(path, BasicFileAttributes.class, options).isDirectory();
2154 * @param path
2155 * the path to the file
2168 public static boolean isRegularFile(Path path, LinkOption... options) {
2170 return readAttributes(path, BasicFileAttributes.class, options).isRegularFile();
2185 * @param path
2186 * the path to the file
2204 public static FileTime getLastModifiedTime(Path path, LinkOption... options)
2207 return readAttributes(path, BasicFileAttributes.class, options).lastModifiedTime();
2222 * Path path = ...
2224 * Files.setLastModifiedTime(path, now);
2227 * @param path
2228 * the path to the file
2243 public static Path setLastModifiedTime(Path path, FileTime time)
2246 getFileAttributeView(path, BasicFileAttributeView.class)
2248 return path;
2258 * @param path
2259 * the path to the file
2272 public static long size(Path path) throws IOException {
2273 return readAttributes(path, BasicFileAttributes.class).size();
2308 * @param path
2309 * the path to the file to test
2323 public static boolean exists(Path path, LinkOption... options) {
2326 provider(path).checkAccess(path);
2329 readAttributes(path, BasicFileAttributes.class,
2342 * Tests whether the file located by this path does not exist. This method
2359 * @param path
2360 * the path to the file to test
2372 public static boolean notExists(Path path, LinkOption... options) {
2375 provider(path).checkAccess(path);
2378 readAttributes(path, BasicFileAttributes.class,
2394 private static boolean isAccessible(Path path, AccessMode... modes) {
2396 provider(path).checkAccess(path, modes);
2417 * @param path
2418 * the path to the file to check
2430 public static boolean isReadable(Path path) {
2431 return isAccessible(path, AccessMode.READ);
2448 * @param path
2449 * the path to the file to check
2461 public static boolean isWritable(Path path) {
2462 return isAccessible(path, AccessMode.WRITE);
2483 * @param path
2484 * the path to the file to check
2496 public static boolean isExecutable(Path path) {
2497 return isAccessible(path, AccessMode.EXECUTE);
2654 * @param path
2655 * the path to the file
2671 public static BufferedReader newBufferedReader(Path path, Charset cs)
2675 Reader reader = new InputStreamReader(newInputStream(path), decoder);
2694 * @param path
2695 * the path to the file
2715 public static BufferedWriter newBufferedWriter(Path path, Charset cs,
2720 Writer writer = new OutputStreamWriter(newOutputStream(path, options), encoder);
2769 * Path path = ...
2772 * Files.copy(in, path);
2779 * the path to the file
2876 * the path to the file
2941 * @param path
2942 * the path to the file
2956 public static byte[] readAllBytes(Path path) throws IOException {
2957 long size = size(path);
2961 try (InputStream in = newInputStream(path)) {
2986 * @param path
2987 * the path to the file
3005 public static List<String> readAllLines(Path path, Charset cs)
3008 try (BufferedReader reader = newBufferedReader(path, cs)) {
3038 * Path path = ...
3040 * Files.write(path, bytes, StandardOpenOption.APPEND);
3043 * @param path
3044 * the path to the file
3050 * @return the path
3061 public static Path write(Path path, byte[] bytes, OpenOption... options)
3067 try (OutputStream out = Files.newOutputStream(path, options)) {
3076 return path;
3098 * @param path
3099 * the path to the file
3107 * @return the path
3119 public static Path write(Path path, Iterable<? extends CharSequence> lines,
3126 OutputStream out = newOutputStream(path, options);
3133 return path;