|
The {@code *} character matches zero or more {@link Character * characters} of a {@link Path#getName(int) name} component without * crossing directory boundaries. </p> * * <li>
The {@code **} characters matches zero or more {@link Character * characters} crossing directory boundaries. </p> * * <li>
The {@code ?} character matches exactly one character of a * name component.</p> * * <li>
The backslash character ({@code \}) is used to escape characters * that would otherwise be interpreted as special characters. The expression * {@code \\} matches a single backslash and "\{" matches a left brace * for example. </p> * * <li>
The {@code [ ]} characters are a bracket expression that * match a single character of a name component out of a set of characters. * For example, {@code [abc]} matches {@code "a"}, {@code "b"}, or {@code "c"}. * The hyphen ({@code -}) may be used to specify a range so {@code [a-z]} * specifies a range that matches from {@code "a"} to {@code "z"} (inclusive). * These forms can be mixed so [abce-g] matches {@code "a"}, {@code "b"}, * {@code "c"}, {@code "e"}, {@code "f"} or {@code "g"}. If the character * after the {@code [} is a {@code !} then it is used for negation so {@code * [!a-c]} matches any character except {@code "a"}, {@code "b"}, or {@code * "c"}. * <p> Within a bracket expression the {@code *}, {@code ?} and {@code \} * characters match themselves. The ({@code -}) character matches itself if * it is the first character within the brackets, or the first character * after the {@code !} if negating.</p> * * <li>
The {@code { }} characters are a group of subpatterns, where * the group matches if any subpattern in the group matches. The {@code ","} * character is used to separate the subpatterns. Groups cannot be nested. * </p> * * <li>
Leading period/dot characters in file name are * treated as regular characters in match operations. For example, * the {@code "*"} glob pattern matches file name {@code ".login"}. * The {@link Files#isHidden} method may be used to test whether a file * is considered hidden. * </p> * * <li>
All other characters match themselves in an implementation * dependent manner. This includes characters representing any {@link * FileSystem#getSeparator name-separators}. </p> * * <li>
The matching of {@link Path#getRoot root} components is highly * implementation-dependent and is not specified. </p> * * </ul> * * <p> When the syntax is "{@code regex}" then the pattern component is a * regular expression as defined by the {@link java.util.regex.Pattern} * class. * * <p> For both the glob and regex syntaxes, the matching details, such as * whether the matching is case sensitive, are implementation-dependent * and therefore not specified. * * @param syntaxAndPattern * The syntax and pattern * * @return A path matcher that may be used to match paths against the pattern * * @throws IllegalArgumentException * If the parameter does not take the form: {@code syntax:pattern} * @throws java.util.regex.PatternSyntaxException * If the pattern is invalid * @throws UnsupportedOperationException * If the pattern syntax is not known to the implementation * * @see Files#newDirectoryStream(Path,String) */ public abstract PathMatcher getPathMatcher(String syntaxAndPattern); /** * Returns the {@code UserPrincipalLookupService} for this file system * <i>(optional operation). The resulting lookup service may be used to * lookup user or group names. * * <p> Usage Example: * Suppose we want to make "joe" the owner of a file: * <pre> * UserPrincipalLookupService lookupService = FileSystems.getDefault().getUserPrincipalLookupService(); * Files.setOwner(path, lookupService.lookupPrincipalByName("joe")); * </pre> * * @throws UnsupportedOperationException * If this {@code FileSystem} does not does have a lookup service * * @return The {@code UserPrincipalLookupService} for this file system */ public abstract UserPrincipalLookupService getUserPrincipalLookupService(); /** * Constructs a new {@link WatchService} <i>(optional operation). * * <p> This method constructs a new watch service that may be used to watch * registered objects for changes and events. * * @return a new watch service * * @throws UnsupportedOperationException * If this {@code FileSystem} does not support watching file system * objects for changes and events. This exception is not thrown * by {@code FileSystems} created by the default provider. * @throws IOException * If an I/O error occurs */ public abstract WatchService newWatchService() throws IOException; }
Here is a short list of links related to this Java FileSystem.java source code file:
Java example source code file (FileSystem.java)
The FileSystem.java Java example source code/* * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package java.nio.file; import java.nio.file.attribute.*; import java.nio.file.spi.FileSystemProvider; import java.util.Set; import java.io.Closeable; import java.io.IOException; /** * Provides an interface to a file system and is the factory for objects to * access files and other objects in the file system. * * <p> The default file system, obtained by invoking the {@link FileSystems#getDefault * FileSystems.getDefault} method, provides access to the file system that is * accessible to the Java virtual machine. The {@link FileSystems} class defines * methods to create file systems that provide access to other types of (custom) * file systems. * * <p> A file system is the factory for several types of objects: * * <ul> * <li> |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.