public final class FilesUncheck extends Object
Files,
IOException,
UncheckedIOExceptionpublic static long copy(InputStream in, Path target, CopyOption... options)
Files.copy(InputStream, Path, CopyOption...) throwing UncheckedIOException instead of
IOException.in - See delegate.target - See delegate.options - See delegate.UncheckedIOException - Wraps an IOException.Files.copy(InputStream, Path,CopyOption...)public static long copy(Path source, OutputStream out)
source - See delegate. See delegate.out - See delegate. See delegate.UncheckedIOException - Wraps an IOException.public static Path copy(Path source, Path target, CopyOption... options)
Files.copy(Path, Path, CopyOption...) throwing UncheckedIOException instead of
IOException.source - See delegate.target - See delegate.options - See delegate.UncheckedIOException - Wraps an IOException.public static Path createDirectories(Path dir, FileAttribute<?>... attrs)
Files.createDirectories(Path, FileAttribute...) throwing UncheckedIOException instead of
IOException.dir - See delegate.attrs - See delegate.UncheckedIOException - Wraps an IOException.public static Path createDirectory(Path dir, FileAttribute<?>... attrs)
Files.createDirectory(Path, FileAttribute...) throwing UncheckedIOException instead of
IOException.dir - See delegate.attrs - See delegate.UncheckedIOException - Wraps an IOException.public static Path createFile(Path path, FileAttribute<?>... attrs)
Files.createFile(Path, FileAttribute...) throwing UncheckedIOException instead of
IOException.path - See delegate.attrs - See delegate.UncheckedIOException - Wraps an IOException.public static Path createLink(Path link, Path existing)
link - See delegate.existing - See delegate.UncheckedIOException - Wraps an IOException.public static Path createSymbolicLink(Path link, Path target, FileAttribute<?>... attrs)
Files.createSymbolicLink(Path, Path, FileAttribute...) throwing UncheckedIOException
instead of IOException.link - See delegate.target - See delegate.attrs - See delegate.UncheckedIOException - Wraps an IOException.public static Path createTempDirectory(Path dir, String prefix, FileAttribute<?>... attrs)
Files.createTempDirectory(Path, String, FileAttribute...) throwing UncheckedIOException
instead of IOException.dir - See delegate.prefix - See delegate.attrs - See delegate.UncheckedIOException - Wraps an IOException.public static Path createTempDirectory(String prefix, FileAttribute<?>... attrs)
Files.createTempDirectory(String, FileAttribute...) throwing UncheckedIOException
instead of IOException.prefix - See delegate.attrs - See delegate.UncheckedIOException - Wraps an IOException.public static Path createTempFile(Path dir, String prefix, String suffix, FileAttribute<?>... attrs)
Files.createTempFile(Path, String, String, FileAttribute...) throwing
UncheckedIOException instead of IOException.dir - See delegate.prefix - See delegate.suffix - See delegate.attrs - See delegate.UncheckedIOException - Wraps an IOException.public static Path createTempFile(String prefix, String suffix, FileAttribute<?>... attrs)
Files.createTempFile(String, String, FileAttribute...) throwing UncheckedIOException
instead of IOException.prefix - See delegate.suffix - See delegate.attrs - See delegate.UncheckedIOException - Wraps an IOException.public static void delete(Path path)
path - See delegate.UncheckedIOException - Wraps an IOException.public static boolean deleteIfExists(Path path)
path - See delegate.UncheckedIOException - Wraps an IOException.public static java.util.stream.Stream<Path> find(Path start, int maxDepth, java.util.function.BiPredicate<Path,BasicFileAttributes> matcher, FileVisitOption... options)
Files.find(Path, int, BiPredicate, FileVisitOption...) throwing UncheckedIOException instead of IOException.
The returned Stream wraps a DirectoryStream. When you require timely disposal of file system resources, use a try-with-resources
block to ensure invocation of the stream's BaseStream.close() method after the stream operations are completed.
start - See delegate.maxDepth - See delegate.matcher - See delegate.options - See delegate.UncheckedIOException - Wraps an IOException.public static Object getAttribute(Path path, String attribute, LinkOption... options)
Files.getAttribute(Path, String, LinkOption...) throwing UncheckedIOException instead of
IOException.path - See delegate.attribute - See delegate.options - See delegate.UncheckedIOException - Wraps an IOException.public static FileStore getFileStore(Path path)
path - See delegate.UncheckedIOException - Wraps an IOException.public static FileTime getLastModifiedTime(Path path, LinkOption... options)
Files.getLastModifiedTime(Path, LinkOption...) throwing UncheckedIOException instead of
IOException.path - See delegate.options - See delegate.UncheckedIOException - Wraps an IOException.public static UserPrincipal getOwner(Path path, LinkOption... options)
Files.getOwner(Path, LinkOption...) throwing UncheckedIOException instead of
IOException.path - See delegate.options - See delegate.UncheckedIOException - Wraps an IOException.public static Set<PosixFilePermission> getPosixFilePermissions(Path path, LinkOption... options)
Files.getPosixFilePermissions(Path, LinkOption...) throwing UncheckedIOException instead
of IOException.path - See delegate.options - See delegate.UncheckedIOException - Wraps an IOException.public static boolean isHidden(Path path)
path - See delegate.UncheckedIOException - Wraps an IOException.public static boolean isSameFile(Path path, Path path2)
path - See delegate.path2 - See delegate.UncheckedIOException - Wraps an IOException.public static java.util.stream.Stream<String> lines(Path path)
Files.lines(Path) throwing UncheckedIOException instead of IOException.
The returned Stream wraps a Reader. When you require timely disposal of file system resources, use a try-with-resources block to
ensure invocation of the stream's BaseStream.close() method after the stream operations are completed.
path - See delegate.UncheckedIOException - Wraps an IOException.public static java.util.stream.Stream<String> lines(Path path, Charset cs)
Files.lines(Path, Charset) throwing UncheckedIOException instead of IOException.
The returned Stream wraps a Reader. When you require timely disposal of file system resources, use a try-with-resources block to
ensure invocation of the stream's BaseStream.close() method after the stream operations are completed.
path - See delegate.cs - See delegate.UncheckedIOException - Wraps an IOException.public static java.util.stream.Stream<Path> list(Path dir)
Files.list(Path) throwing UncheckedIOException instead of IOException.
The returned Stream wraps a DirectoryStream. When you require timely disposal of file system resources, use a try-with-resources
block to ensure invocation of the stream's BaseStream.close() method after the stream operations are completed.
dir - See delegate.UncheckedIOException - Wraps an IOException.public static Path move(Path source, Path target, CopyOption... options)
Files.move(Path, Path, CopyOption...) throwing UncheckedIOException instead of
IOException.source - See delegate.target - See delegate.options - See delegate.UncheckedIOException - Wraps an IOException.public static BufferedReader newBufferedReader(Path path)
path - See delegate.UncheckedIOException - Wraps an IOException.public static BufferedReader newBufferedReader(Path path, Charset cs)
Files.newBufferedReader(Path, Charset) throwing UncheckedIOException instead of
IOException.path - See delegate.cs - See delegate.UncheckedIOException - Wraps an IOException.public static BufferedWriter newBufferedWriter(Path path, Charset cs, OpenOption... options)
Files.newBufferedWriter(Path, Charset, OpenOption...) throwing UncheckedIOException
instead of IOException.path - See delegate.cs - See delegate.options - See delegate.UncheckedIOException - Wraps an IOException.public static BufferedWriter newBufferedWriter(Path path, OpenOption... options)
Files.newBufferedWriter(Path, OpenOption...) throwing UncheckedIOException instead of
IOException.path - See delegate.options - See delegate.UncheckedIOException - Wraps an IOException.public static SeekableByteChannel newByteChannel(Path path, OpenOption... options)
Files.newByteChannel(Path, OpenOption...) throwing UncheckedIOException instead of
IOException.path - See delegate.options - See delegate.UncheckedIOException - Wraps an IOException.public static SeekableByteChannel newByteChannel(Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs)
Files.newByteChannel(Path, Set, FileAttribute...) throwing UncheckedIOException instead
of IOException.path - See delegate.options - See delegate.attrs - See delegate.UncheckedIOException - Wraps an IOException.public static DirectoryStream<Path> newDirectoryStream(Path dir)
Files.newDirectoryStream(Path) throwing UncheckedIOException instead of IOException.
If you don't use the try-with-resources construct, then you must call the stream's BaseStream.close() method after iteration is complete to free any
resources held for the open directory.
dir - See delegate.public static DirectoryStream<Path> newDirectoryStream(Path dir, DirectoryStream.Filter<? super Path> filter)
Files.newDirectoryStream(Path, java.nio.file.DirectoryStream.Filter) throwing UncheckedIOException instead of
IOException.
If you don't use the try-with-resources construct, then you must call the stream's BaseStream.close() method after iteration is complete to free any
resources held for the open directory.
dir - See delegate.filter - See delegate.public static DirectoryStream<Path> newDirectoryStream(Path dir, String glob)
Files.newDirectoryStream(Path, String) throwing UncheckedIOException instead of
IOException.
The returned Stream wraps a DirectoryStream. When you require timely disposal of file system resources, use a try-with-resources
block to ensure invocation of the stream's BaseStream.close() method after the stream operations are completed.
dir - See delegate.glob - See delegate.public static InputStream newInputStream(Path path, OpenOption... options)
Files.newInputStream(Path, OpenOption...) throwing UncheckedIOException instead of
IOException.path - See delegate.options - See delegate.public static OutputStream newOutputStream(Path path, OpenOption... options)
Files.newOutputStream(Path, OpenOption...) throwing UncheckedIOException instead of
IOException.path - See delegate.options - See delegate.public static String probeContentType(Path path)
path - See delegate.public static byte[] readAllBytes(Path path)
path - See delegate.public static List<String> readAllLines(Path path)
path - See delegate.public static List<String> readAllLines(Path path, Charset cs)
Files.readAllLines(Path, Charset) throwing UncheckedIOException instead of
IOException.path - See delegate.cs - See delegate.public static <A extends BasicFileAttributes> A readAttributes(Path path, Class<A> type, LinkOption... options)
Files.readAttributes(Path, Class, LinkOption...) throwing UncheckedIOException instead
of IOException.A - See delegate.path - See delegate.type - See delegate.options - See delegate.public static Map<String,Object> readAttributes(Path path, String attributes, LinkOption... options)
Files.readAttributes(Path, String, LinkOption...) throwing UncheckedIOException instead
of IOException.path - See delegate.attributes - See delegate.options - See delegate.public static Path readSymbolicLink(Path link)
link - See delegate.public static Path setAttribute(Path path, String attribute, Object value, LinkOption... options)
Files.setAttribute(Path, String, Object, LinkOption...) throwing UncheckedIOException
instead of IOException.path - See delegate.attribute - See delegate.value - See delegate.options - See delegate.public static Path setLastModifiedTime(Path path, FileTime time)
Files.setLastModifiedTime(Path, FileTime) throwing UncheckedIOException instead of
IOException.path - See delegate.time - See delegate.public static Path setOwner(Path path, UserPrincipal owner)
Files.setOwner(Path, UserPrincipal) throwing UncheckedIOException instead of
IOException.path - See delegate.owner - See delegate.public static Path setPosixFilePermissions(Path path, Set<PosixFilePermission> perms)
Files.setPosixFilePermissions(Path, Set) throwing UncheckedIOException instead of
IOException.path - See delegate.perms - See delegate.public static long size(Path path)
path - See delegate.public static java.util.stream.Stream<Path> walk(Path start, FileVisitOption... options)
Files.walk(Path, FileVisitOption...) throwing UncheckedIOException instead of IOException.
The returned Stream may wrap one or more DirectoryStreams. When you require timely disposal of file system resources, use a
try-with-resources block to ensure invocation of the stream's BaseStream.close() method after the stream operations are completed. Calling a
closed stream causes a IllegalStateException.
start - See delegate.options - See delegate.public static java.util.stream.Stream<Path> walk(Path start, int maxDepth, FileVisitOption... options)
Files.walk(Path, int, FileVisitOption...) throwing UncheckedIOException instead of IOException.
The returned Stream may wrap one or more DirectoryStreams. When you require timely disposal of file system resources, use a
try-with-resources block to ensure invocation of the stream's BaseStream.close() method after the stream operations are completed. Calling a
closed stream causes a IllegalStateException.
start - See delegate.maxDepth - See delegate.options - See delegate.public static Path walkFileTree(Path start, FileVisitor<? super Path> visitor)
Files.walkFileTree(Path, FileVisitor) throwing UncheckedIOException instead of
IOException.start - See delegate.visitor - See delegate.public static Path walkFileTree(Path start, Set<FileVisitOption> options, int maxDepth, FileVisitor<? super Path> visitor)
Files.walkFileTree(Path, Set, int, FileVisitor) throwing UncheckedIOException instead of
IOException.start - See delegate.options - See delegate.maxDepth - See delegate.visitor - See delegate.public static Path write(Path path, byte[] bytes, OpenOption... options)
Files.write(Path, byte[], OpenOption...) throwing UncheckedIOException instead of
IOException.path - See delegate.bytes - See delegate.options - See delegate.public static Path write(Path path, Iterable<? extends CharSequence> lines, Charset cs, OpenOption... options)
Files.write(Path, Iterable, Charset, OpenOption...) throwing UncheckedIOException
instead of IOException.path - See delegate.lines - See delegate.cs - See delegate.options - See delegate.public static Path write(Path path, Iterable<? extends CharSequence> lines, OpenOption... options)
Files.write(Path, Iterable, OpenOption...) throwing UncheckedIOException instead of
IOException.path - See delegate.lines - See delegate.options - See delegate.