public final class Files extends Object
public static InputStream newInputStream(Path path, OpenOption... options) throws IllegalArgumentException, NoSuchFileException, UnsupportedOperationException, IOException, SecurityException
IllegalArgumentExceptionUnsupportedOperationExceptionNoSuchFileExceptionIOExceptionSecurityExceptionpublic static OutputStream newOutputStream(Path path, OpenOption... options) throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException
public static SeekableByteChannel newByteChannel(Path path, OpenOption... options) throws IllegalArgumentException, UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException
IllegalArgumentExceptionUnsupportedOperationExceptionFileAlreadyExistsExceptionIOExceptionSecurityExceptionpublic static SeekableByteChannel newByteChannel(Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs) throws IllegalArgumentException, UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException
IllegalArgumentExceptionUnsupportedOperationExceptionFileAlreadyExistsExceptionIOExceptionSecurityExceptionpublic static DirectoryStream<Path> newDirectoryStream(Path dir) throws IllegalArgumentException, NotDirectoryException, IOException, SecurityException
IllegalArgumentExceptionNotDirectoryExceptionIOExceptionSecurityExceptionpublic static DirectoryStream<Path> newDirectoryStream(Path dir, String glob) throws IllegalArgumentException, UnsupportedOperationException, PatternSyntaxException, NotDirectoryException, IOException, SecurityException
public static DirectoryStream<Path> newDirectoryStream(Path dir, DirectoryStream.Filter<Path> filter) throws IllegalArgumentException, NotDirectoryException, IOException, SecurityException
IllegalArgumentExceptionNotDirectoryExceptionIOExceptionSecurityExceptionpublic static Path createFile(Path path, FileAttribute<?>... attrs) throws IllegalArgumentException, UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException
IllegalArgumentExceptionUnsupportedOperationExceptionFileAlreadyExistsExceptionIOExceptionSecurityExceptionpublic static Path createDirectory(Path dir, FileAttribute<?>... attrs) throws IllegalArgumentException, UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException
IllegalArgumentExceptionUnsupportedOperationExceptionFileAlreadyExistsExceptionIOExceptionSecurityExceptionpublic static Path createDirectories(Path dir, FileAttribute<?>... attrs) throws UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException
public static Path createSymbolicLink(Path link, Path target, FileAttribute<?>... attrs) throws IllegalArgumentException, UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException
IllegalArgumentExceptionUnsupportedOperationExceptionFileAlreadyExistsExceptionIOExceptionSecurityExceptionpublic static Path createLink(Path link, Path existing) throws IllegalArgumentException, UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException
IllegalArgumentExceptionUnsupportedOperationExceptionFileAlreadyExistsExceptionIOExceptionSecurityExceptionpublic static void delete(Path path, DeleteOption... options) throws IllegalArgumentException, NoSuchFileException, DirectoryNotEmptyException, IOException, SecurityException
IllegalArgumentExceptionNoSuchFileExceptionDirectoryNotEmptyExceptionIOExceptionSecurityExceptionpublic static boolean deleteIfExists(Path path, DeleteOption... options) throws IllegalArgumentException, DirectoryNotEmptyException, IOException, SecurityException
IllegalArgumentExceptionDirectoryNotEmptyExceptionIOExceptionSecurityExceptionpublic static Path createTempFile(String prefix, String suffix, FileAttribute<?>... attrs) throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException
public static Path createTempFile(Path dir, String prefix, String suffix, FileAttribute<?>... attrs) throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException
public static Path createTempDirectory(String prefix, FileAttribute<?>... attrs) throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException
public static Path createTempDirectory(Path dir, String prefix, FileAttribute<?>... attrs) throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException
public static Path copy(Path source, Path target, CopyOption... options) throws UnsupportedOperationException, FileAlreadyExistsException, DirectoryNotEmptyException, IOException, SecurityException
public static Path move(Path source, Path target, CopyOption... options) throws UnsupportedOperationException, FileAlreadyExistsException, DirectoryNotEmptyException, AtomicMoveNotSupportedException, IOException, SecurityException
public static Path readSymbolicLink(Path link) throws IllegalArgumentException, UnsupportedOperationException, NotLinkException, IOException, SecurityException
IllegalArgumentExceptionUnsupportedOperationExceptionNotLinkExceptionIOExceptionSecurityExceptionpublic static FileStore getFileStore(Path path) throws IllegalArgumentException, IOException, SecurityException
IllegalArgumentExceptionIOExceptionSecurityExceptionpublic static String probeContentType(Path path) throws UnsupportedOperationException, IOException, SecurityException
public static <V extends FileAttributeView> V getFileAttributeView(Path path, Class<V> type, LinkOption... options) throws IllegalArgumentException
IllegalArgumentExceptionpublic static <A extends BasicFileAttributes> A readAttributes(Path path, Class<A> type, LinkOption... options) throws IllegalArgumentException, NoSuchFileException, UnsupportedOperationException, IOException, SecurityException
public static Map<String,Object> readAttributes(Path path, String attributes, LinkOption... options) throws UnsupportedOperationException, NoSuchFileException, IllegalArgumentException, IOException, SecurityException
public static Path setAttribute(Path path, String attribute, Object value, LinkOption... options) throws UnsupportedOperationException, IllegalArgumentException, ClassCastException, IOException, SecurityException
public static Object getAttribute(Path path, String attribute, LinkOption... options) throws UnsupportedOperationException, IllegalArgumentException, IOException, SecurityException
public static Set<PosixFilePermission> getPosixFilePermissions(Path path, LinkOption... options) throws UnsupportedOperationException, IOException, SecurityException
public static Path setPosixFilePermissions(Path path, Set<PosixFilePermission> perms) throws UnsupportedOperationException, ClassCastException, IOException, SecurityException
public static UserPrincipal getOwner(Path path, LinkOption... options) throws UnsupportedOperationException, IOException, SecurityException
public static Path setOwner(Path path, UserPrincipal owner) throws UnsupportedOperationException, IOException, SecurityException
public static FileTime getLastModifiedTime(Path path, LinkOption... options) throws IllegalArgumentException, IOException, SecurityException
IllegalArgumentExceptionIOExceptionSecurityExceptionpublic static Path setLastModifiedTime(Path path, FileTime time) throws IOException, SecurityException
IOExceptionSecurityExceptionpublic static long size(Path path) throws IllegalArgumentException, IOException, SecurityException
IllegalArgumentExceptionIOExceptionSecurityExceptionpublic static boolean exists(Path path, LinkOption... options) throws IllegalArgumentException, SecurityException
IllegalArgumentExceptionSecurityExceptionpublic static boolean notExists(Path path, LinkOption... options) throws IllegalArgumentException, SecurityException
IllegalArgumentExceptionSecurityExceptionpublic static boolean isSameFile(Path path, Path path2) throws IllegalArgumentException, IOException, SecurityException
IllegalArgumentExceptionIOExceptionSecurityExceptionpublic static boolean isHidden(Path path) throws IllegalArgumentException, IOException, SecurityException
IllegalArgumentExceptionIOExceptionSecurityExceptionpublic static boolean isReadable(Path path) throws IllegalArgumentException, SecurityException
IllegalArgumentExceptionSecurityExceptionpublic static boolean isWritable(Path path) throws IllegalArgumentException, SecurityException
IllegalArgumentExceptionSecurityExceptionpublic static boolean isExecutable(Path path) throws IllegalArgumentException, SecurityException
IllegalArgumentExceptionSecurityExceptionpublic static boolean isSymbolicLink(Path path) throws IllegalArgumentException, SecurityException
IllegalArgumentExceptionSecurityExceptionpublic static boolean isDirectory(Path path, LinkOption... options) throws IllegalArgumentException, SecurityException
IllegalArgumentExceptionSecurityExceptionpublic static boolean isRegularFile(Path path, LinkOption... options) throws IllegalAccessError, SecurityException
IllegalAccessErrorSecurityExceptionpublic static Path walkFileTree(Path start, Set<FileVisitOption> options, int maxDepth, FileVisitor<Path> visitor) throws IllegalArgumentException, SecurityException, IOException
public static Path walkFileTree(Path start, FileVisitor<Path> visitor) throws IllegalArgumentException, IOException, SecurityException
IllegalArgumentExceptionIOExceptionSecurityExceptionpublic static BufferedReader newBufferedReader(Path path, Charset cs) throws IllegalArgumentException, NoSuchFileException, IOException, SecurityException
IllegalArgumentExceptionNoSuchFileExceptionIOExceptionSecurityExceptionpublic static BufferedWriter newBufferedWriter(Path path, Charset cs, OpenOption... options) throws IllegalArgumentException, IOException, UnsupportedOperationException, SecurityException
public static long copy(InputStream in, Path target, CopyOption... options) throws IOException, FileAlreadyExistsException, DirectoryNotEmptyException, UnsupportedOperationException, SecurityException
public static long copy(Path source, OutputStream out) throws IOException, SecurityException
IOExceptionSecurityExceptionpublic static byte[] readAllBytes(Path path) throws IOException, OutOfMemoryError, SecurityException
public static List<String> readAllLines(Path path, Charset cs) throws IllegalArgumentException, NoSuchFileException, IOException, SecurityException
IllegalArgumentExceptionNoSuchFileExceptionIOExceptionSecurityExceptionpublic static Path write(Path path, byte[] bytes, OpenOption... options) throws IOException, UnsupportedOperationException, SecurityException
public static Path write(Path path, Iterable<? extends CharSequence> lines, Charset cs, OpenOption... options) throws IllegalArgumentException, IOException, UnsupportedOperationException, SecurityException
Copyright © 2012–2018 JBoss by Red Hat. All rights reserved.