1. copy(InputStream in, Path target, CopyOption… options): This method copies all bytes from specified input stream to specified target file and it returns number of bytes read or written as long value.copy(InputStream输入,路径目标,CopyOption…选项):此方法将所有字节从指定的输入流复制到指定的目标文件,并返回读取或写入的字节数作为long值。
    2. copy(Path source, OutputStream out): This method copies all bytes from specified source file to given output stream and it returns number of bytes read or written as long value.copy(Path source,OutputStream out):此方法将所有字节从指定的源文件复制到给定的输出流,并且将读取或写入的字节数作为long值返回。
    3. copy(Path source, Path target, CopyOption… options): This method copies given source file to specified target file and it returns path of target file.复制(路径源,路径目标,CopyOption…选项):此方法将给定的源文件复制到指定的目标文件,并返回目标文件的路径。
    4. createDirectories(Path dir, FileAttribute<?>… attrs): This method creates a directories using given path by creating all nonexistent parent directories first. This method will not throw an exception if the directory could not be created because it already exists. FileAttribute is an optional parameter to set automatically when creating the nonexistent directories and it returns the path of created directory.createDirectories(Path dir,FileAttribute <?>…attrs):此方法通过首先创建所有不存在的父目录来使用给定路径创建目录。 如果由于目录已经存在而无法创建目录,则此方法不会引发异常。 FileAttribute是一个可选参数,可在创建不存在的目录时自动设置,并返回创建目录的路径。
    5. createDirectory(Path dir, FileAttribute<?>… attrs): This method creates a directory using given path, if it creates directory successfully it will returns the path of the created directory. If directory is already exists then it will throw nio.file.FileAlreadyExistsException.createDirectory(Path dir,FileAttribute <?>…attrs):此方法使用给定路径创建目录,如果成功创建目录,它将返回已创建目录的路径。 如果目录已经存在,则将抛出nio.file.FileAlreadyExistsException。
    6. createFile(Path path, FileAttribute<?>… attrs): This method creates a new empty file using given path and returns path of newly created file if it creates it successfully. If file is already exists then it will throw nio.file.FileAlreadyExistsException.createFile(Path path,FileAttribute <?>…attrs):此方法使用给定路径创建一个新的空文件,如果成功创建,则返回新创建文件的路径。 如果文件已经存在,则将抛出nio.file.FileAlreadyExistsException。
    7. createTempDirectory(Path dir, String prefix, FileAttribute<?>… attrs): This method creates a Temporary directory using given path and it will generate the name of directory using given prefix. It will return the path of newly created temporary directory.createTempDirectory(路径目录,字符串前缀,FileAttribute <?>…attrs):此方法使用给定的路径创建一个临时目录,并将使用给定的前缀生成目录的名称。 它将返回新创建的临时目录的路径。
    8. createTempDirectory(String prefix, FileAttribute<?>… attrs): This method creates a Temporary directory in the default temporary-file directory and generate the name of directory using given prefix. It will return the path of newly created temporary directory which is associated with the default File System.createTempDirectory(String prefix,FileAttribute <?>…attrs):此方法在默认的临时文件目录中创建一个Temporary目录,并使用给定的前缀生成目录的名称。 它将返回与默认文件系统关联的新创建的临时目录的路径。
    9. createTempFile(Path dir, String prefix, String suffix, FileAttribute<?>… attrs): This method creates a temporary file at specified directory and generates the file name using given prefix and suffix and returns the path of newly created file.createTempFile(路径目录,字符串前缀,字符串后缀,FileAttribute <?>…attrs):此方法在指定目录下创建一个临时文件,并使用给定的前缀和后缀生成文件名,并返回新创建文件的路径。
    10. createTempFile(String prefix, String suffix, FileAttribute<?>… attrs): This method creates a temporary file at default temporary-file directory and generates the file name using given prefix and suffix and returns the path of newly created file.createTempFile(字符串前缀,字符串后缀,FileAttribute <?>…attrs):此方法在默认的临时文件目录中创建一个临时文件,并使用给定的前缀和后缀生成文件名,并返回新创建文件的路径。
    11. delete(Path path): This is a void method and simply deletes the file from specified path. This method throws NoSuchFileException if the file is not exists at specified path and if the file is directory and it may not empty and cannot be deleted, in this case it will throwsdelete(Path path):这是一个void方法,只是从指定路径中删除文件。 如果该文件在指定路径下不存在,并且该文件是目录,并且该文件可能不为空并且无法删除,则此方法将引发NoSuchFileException。
    12. deleteIfExists(Path path): This methods checks if file exists before delete the file and returns boolean value true if the file at the given path gets deleted successfully and returns false if the file is not exists at given path. If the file is directory and it may not empty and cannot be deleted, in this case it will throwsdeleteIfExists(Path path):此方法在删除文件之前检查文件是否存在,如果在给定路径下的文件被成功删除,则返回布尔值true;如果在给定路径下不存在文件,则返回false。 如果文件是目录,并且它可能不为空并且无法删除,则在这种情况下它将抛出
    13. exists(Path path): This method checks if file exists at specified path and if the file exists it will return true or else it returns false.exist(Path path):此方法检查文件是否在指定的路径处存在,并且如果文件存在,它将返回true,否则返回false。
    14. getLastModifiedTime(Path path, Linkoption… options): This method returns a file’s last modified time from given path asgetLastModifiedTime(Path path,Linkoption…options):此方法从给定路径返回文件的上次修改时间,如下所示:
    15. getOwner(Path path, Linkoption… options): This method returns UserPrincipal representing the owner of the file at given path.getOwner(Path path,Linkoption…options):此方法返回UserPrincipal,它表示给定路径下文件的所有者。
    16. isDirectory(Path path, Linkoption… options): This method checks if the file is a directory from given path. It returns true if the file is directory and false if the file does not exists or is not a directory or it cannot be determined if the file is a directory or not.isDirectory(路径路径,Linkoption…选项):此方法检查文件是否为给定路径中的目录。 如果该文件是目录,则返回true;如果该文件不存在或不是目录,则返回false;或者,如果该文件不是目录,则返回false。
    17. isExecutable(Path path): This method checks whether file at given path is executable or not and it also checks that file exists and that this JVM has appropriate privilege to execute the file. It returns true if the file is exists at given path and is executable and false if the file does not exists or JVM has not sufficient privilege to execute file or access cannot be determined.isExecutable(Path path):此方法检查给定路径上的文件是否可执行,还检查文件是否存在以及此JVM具有执行该文件的适当特权。 如果文件存在于给定的路径并且可以执行,则返回true;如果文件不存在或者JVM没有足够的特权执行文件或无法确定访问,则返回false。
    18. isHidden(Path path): This method tells whether file at given is considered as hidden or not. The exact definition of hidden is platform or provider dependent. In case of UNIX system a file is considered hidden if the name of file is starts with period character (‘.’) And in case of WINDOWS file is considered as hidden if it is not a directory and DOS hidden attribute is set. It returns true if the file at given path is considered as hidden or else false.isHidden(Path path):此方法指示给定文件是否被视为隐藏。 隐藏的确切定义取决于平台或提供者。 在UNIX系统中,如果文件名以句点字符(’。’开头),则该文件被认为是隐藏的;在WINDOWS文件中,如果该文件不是目录并且设置了DOS hidden属性,则该文件被认为是隐藏的。 如果将给定路径下的文件视为隐藏文件,则返回true,否则返回false。
    19. isReadable(Path path): This method tests whether the file at given path is readable or not. It reruns true if the file at specified path exists and is readable and false if the file does not exists or read access is denied because JVM does not has sufficient privilege or access cannot be determined.isReadable(Path path):此方法测试给定路径下的文件是否可读。 如果指定路径上的文件存在并且可读,则重新运行true;如果文件不存在,则重新运行false;或者由于JVM没有足够的特权或无法确定访问而拒绝读取访问。
    20. isWritable(Path path): This method tests whether the file at given path is writable or not. It reruns true if the file at specified path exists and is writable and false if the file does not exists or write access is denied because JVM does not has sufficient privilege or access cannot be determined.isWritable(Path path):此方法测试给定路径处的文件是否可写。 如果指定路径上的文件存在并且可写,则重新运行true;如果文件不存在或由于JVM没有足够的特权或无法确定访问而拒绝写访问,则重新运行false。
    21. move(Path source, Path target, CopyOption… options): This method move or rename a source file to target file and returns the path of target file. Option parameter may include following :
      REPLACE_EXISTING: It means if the target file exists then replaces it if it is not a non-empty directory.ATOMIC_MOVE: It means move is performed as atomic file system operation and all other options are ignored.This method throws FileAleadyExistsException if the target file exists but cannot be replaced because the REPLACE_EXISTING option is not specified.This method throws DirectoryNotEmptyException if REPlACE_EXISTING option is specified but the file cannot be replaced because it is a non-empty directory.move(路径源,路径目标,CopyOption…选项):此方法将源文件移动或重命名为目标文件,并返回目标文件的路径。 选项参数可能包括以下内容:
      REPLACE_EXISTING:这意味着目标文件是否存在,如果它不是非空目录,则将其替换。ATOMIC_MOVE:这意味着移动是作为原子文件系统操作执行的,所有其他选项都将被忽略。如果目标文件存在,但由于未指定REPLACE_EXISTING选项而无法替换,则此方法将引发FileAleadyExistsException 。如果指定了REPlACE_EXISTING选项,则此方法将抛出DirectoryNotEmptyException ,但是由于该文件是非空目录,因此无法替换。
    22. newBufferedReader(Path path, Charset cs): This method opens a file using given path for reading by returning a BufferedReader that used to read text from the file.Bytes from the file are decoded into characters using the specified charset.newBufferedReader(Path path,Charset cs):此方法通过返回用于读取文件文本的BufferedReader使用给定的路径打开文件以进行读取。使用指定的字符集将文件中的字节解码为字符。
    23. newBufferedWriter(Path path, Charset cs, Openoption… options): This method opens or creates a file using given path for writing by returning BufferedWriter that used to write text to the file. The options parameter specifies how the file is created or opened. If no option is specified then it consider CREATE, TRUNCATE_EXISTING and WRITE options by default, this means it opens the file for writing and creates if the file does not exist or truncate existing file to size of 0 if it exists. This method throws UnsupportedOperationException if unsupported option is specified.newBufferedWriter(路径,Charset cs,Openoption…选项):此方法通过返回用于将文本写入文件的BufferedWriter,使用给定的写入路径打开或创建文件。 options参数指定如何创建或打开文件。 如果未指定任何选项,则默认情况下会考虑CREATE,TRUNCATE_EXISTINGWRITE选项,这意味着它将打开要写入的文件并创建文件是否不存在,或者将现有文件截断为0(如果存在)。 如果指定了支持的选项,则此方法将引发UnsupportedOperationException
    24. newByteChannel(Path path, OpenOption… options): This method creates or opens the file using specified path by returning a seekable byte channel to access the file. This method throws UnsupportedOperationException if unsupported option is specified.newByteChannel(路径路径,OpenOption…选项):此方法通过返回可搜索的字节通道来访问文件,从而使用指定的路径创建或打开文件。 如果指定了支持的选项,则此方法将引发UnsupportedOperationException
    25. newDirectoryStream(Path path): This method opens a directory by returning a DirectoryStream to iterate over all entries in the directory from the specified path. The elements return by DirectoryStream’s iterator are of type Path and each one represents an entry in the directory. This method throws NotDirectoryException if the file at given path could not be opened because it is not a directory.newDirectoryStream(Path path):此方法通过返回DirectoryStream来从指定路径遍历目录中的所有条目来打开目录。 DirectoryStream的迭代器返回的元素的类型为Path,每个元素代表目录中的一项。 如果由于给定路径下的文件不是目录而无法打开,则此方法将引发NotDirectoryException
    26. newDirectoryStream(Path path, Filter<? super Path > filter): This method opens a directory by returning a DirectoryStream to iterate over all entries in the directory from the specified path. The elements return by DirectoryStream’s iterator are of type Path and each one represents an entry in the directory and these entries are filtered by the specified filter. This method throws NotDirectoryException if the file at given path could not be opened because it is not a directory.newDirectoryStream(路径路径,Filter <?超级路径>过滤器):此方法通过返回DirectoryStream来从指定路径遍历目录中的所有条目来打开目录。 DirectoryStream的迭代器返回的元素的类型为Path,每个元素都代表目录中的一个条目,并且这些条目由指定的过滤器过滤。 如果由于给定路径下的文件不是目录而无法打开,则此方法将引发NotDirectoryException
    27. newDirectoryStream(Path path, String glob): This method opens a directory by returning a DirectoryStream to iterate over all entries in the directory from the specified path. The elements return by DirectoryStream’s iterator are of type Path and each one represents an entry in the directory and these entries is filtered by matching the String representation of their file names against the specified globbing pattern. This method throws NotDirectoryException if the file at given path could not be opened because it is not a directory and PatternSyntaxException if the pattern is invalid.newDirectoryStream(Path path,String glob):此方法通过返回DirectoryStream以从指定路径遍历目录中的所有条目来打开目录。 DirectoryStream的迭代器返回的元素的类型为Path,每个元素代表目录中的一项,并且通过将其文件名的String表示与指定的glob模式匹配来过滤这些项。 如果由于给定路径下的文件不是目录而无法打开该方法,则抛出NotDirectoryException;如果模式无效,则抛出PatternSyntaxException
    28. newInputStream(Path path, Openoption… options): This method opens a file by returning input stream to read the file from specified path. The options parameter is determines how the file is opened and if no options are specified then it opens the file with READ This method throws IllegalArgumentException if an invalid combination of options is specified and UnsupportedOperationException if an unsupported option is specified.newInputStream(路径路径,Openoption…选项):此方法通过返回输入流以从指定路径读取文件来打开文件。 options参数确定打开文件的方式,如果未指定选项,则使用READ打开文件。如果指定了无效的选项组合,则此方法引发IllegalArgumentException;如果指定了不受支持的选项,则引发UnsupportedOperationException
    29. newOutputStream(Path path, Openoption… options): This method opens a file by returning output stream to write bytes to the file at specified path. The options parameter is determines how the file is opened and If no option is specified then it consider CREATE, TRUNCATE_EXISTING and WRITE options by default, this means it opens the file for writing and creates if the file does not exist or truncate existing file to size of 0 if it exists. This method throws IllegalArgumentException if an invalid combination of options is specified and UnsupportedOperationException if an unsupported option is specified.newOutputStream(路径路径,Openoption…选项):此方法通过返回输出流以将字节写入指定路径的文件来打开文件。 options参数确定打开文件的方式,如果未指定任何选项,则默认情况下考虑CREATE,TRUNCATE_EXISTINGWRITE选项,这意味着它将打开文件进行写入并创建文件是否不存在或将现有文件截断成大小如果存在,则为0。 如果指定了无效的选项组合,则此方法引发IllegalArgumentException;如果指定了不受支持的选项,则引发UnsupportedOperationException
    30. notExists(Path path, LinkOption options): This method tests whether the file at specified path does not exists. The options parameter is used to indicate how symbolic links are handled if the file is symbolic link. By default, symbolic links are followed. If the option NOFOLLOW_LINK is present then symbolic links are not followed. This method returns true if file does not exist at specified path and false if the file exists or if its existence cannot be determined.notExists(路径,LinkOption选项):此方法测试指定路径处的文件是否不存在。 options参数用于指示如果文件是符号链接,则如何处理符号链接。 默认情况下,遵循符号链接。 如果存在选项NOFOLLOW_LINK ,则不遵循符号链接。 如果文件在指定路径不存在,则此方法返回true;如果文件存在或无法确定其存在,则返回false。
    31. readAllBytes(Path path): This method reads all the bytes from the file at given path and returns the byte array containing the bytes read from the file.readAllBytes(Path path):此方法从给定路径中的文件读取所有字节,并返回包含从文件读取的字节的字节数组。
    32. readAllLines(Path path, Charset cs): This method read all lines from the file at given path and returns the List containing the lines from the file.readAllLines(Path path,Charset cs):此方法从给定路径的文件中读取所有行,并返回包含文件中的行的List
    33. size(Path path): This method returns the size of the file at specified path in bytes.size(Path path):此方法返回指定路径上文件的大小(以字节为单位)。
    34. walkFileTree(Path start, FileVisitor<? Super Path> visitor): This method used to traverse the directory. It traverses the directory at specified path recursively and returns the starting file.walkFileTree(路径开始,FileVisitor <?Super Path>访问者):此方法用于遍历目录。 它以递归方式遍历目录中的指定路径,并返回起始文件。
    35. write(Path path, byte[] bytes, OpenOption… options): This method writes bytes to a file at specified path. The options parameter specifies how the file is created or opened. If no option is specified then it consider CREATE, TRUNCATE_EXISTING and WRITE options by default, this means it opens the file for writing and creates if the file does not exist or truncate existing file to size of 0 if it exists. All the bytes in byte array are written to the file. This method ensures that the file is closed when all the bytes have been written and returns the path of written file.write(路径,byte []个字节,OpenOption…选项):此方法将字节写入指定路径的文件。 options参数指定如何创建或打开文件。 如果未指定任何选项,则默认情况下会考虑CREATE,TRUNCATE_EXISTINGWRITE选项,这意味着它将打开要写入的文件并创建文件是否不存在,或者将现有文件截断为0(如果存在)。 字节数组中的所有字节均写入文件。 此方法可确保在写入所有字节后关闭文件,并返回写入文件的路径。