Class FilesUncheck
- Since:
- 2.12.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic longcopy(InputStream in, Path target, CopyOption... options) Delegates toFiles.copy(InputStream, Path, CopyOption...)throwingUncheckedIOExceptioninstead ofIOException.static longcopy(Path source, OutputStream out) static Pathcopy(Path source, Path target, CopyOption... options) Delegates toFiles.copy(Path, Path, CopyOption...)throwingUncheckedIOExceptioninstead ofIOException.static PathcreateDirectories(Path dir, FileAttribute<?>... attrs) Delegates toFiles.createDirectories(Path, FileAttribute...)throwingUncheckedIOExceptioninstead ofIOException.static PathcreateDirectory(Path dir, FileAttribute<?>... attrs) Delegates toFiles.createDirectory(Path, FileAttribute...)throwingUncheckedIOExceptioninstead ofIOException.static PathcreateFile(Path path, FileAttribute<?>... attrs) Delegates toFiles.createFile(Path, FileAttribute...)throwingUncheckedIOExceptioninstead ofIOException.static PathcreateLink(Path link, Path existing) static PathcreateSymbolicLink(Path link, Path target, FileAttribute<?>... attrs) Delegates toFiles.createSymbolicLink(Path, Path, FileAttribute...)throwingUncheckedIOExceptioninstead ofIOException.static PathcreateTempDirectory(String prefix, FileAttribute<?>... attrs) Delegates toFiles.createTempDirectory(String, FileAttribute...)throwingUncheckedIOExceptioninstead ofIOException.static PathcreateTempDirectory(Path dir, String prefix, FileAttribute<?>... attrs) Delegates toFiles.createTempDirectory(Path, String, FileAttribute...)throwingUncheckedIOExceptioninstead ofIOException.static PathcreateTempFile(String prefix, String suffix, FileAttribute<?>... attrs) Delegates toFiles.createTempFile(String, String, FileAttribute...)throwingUncheckedIOExceptioninstead ofIOException.static PathcreateTempFile(Path dir, String prefix, String suffix, FileAttribute<?>... attrs) Delegates toFiles.createTempFile(Path, String, String, FileAttribute...)throwingUncheckedIOExceptioninstead ofIOException.static voidstatic booleandeleteIfExists(Path path) find(Path start, int maxDepth, BiPredicate<Path, BasicFileAttributes> matcher, FileVisitOption... options) Delegates toFiles.find(Path, int, BiPredicate, FileVisitOption...)throwingUncheckedIOExceptioninstead ofIOException.static ObjectgetAttribute(Path path, String attribute, LinkOption... options) Delegates toFiles.getAttribute(Path, String, LinkOption...)throwingUncheckedIOExceptioninstead ofIOException.static FileStoregetFileStore(Path path) static FileTimegetLastModifiedTime(Path path, LinkOption... options) Delegates toFiles.getLastModifiedTime(Path, LinkOption...)throwingUncheckedIOExceptioninstead ofIOException.static UserPrincipalgetOwner(Path path, LinkOption... options) Delegates toFiles.getOwner(Path, LinkOption...)throwingUncheckedIOExceptioninstead ofIOException.static Set<PosixFilePermission> getPosixFilePermissions(Path path, LinkOption... options) Delegates toFiles.getPosixFilePermissions(Path, LinkOption...)throwingUncheckedIOExceptioninstead ofIOException.static booleanstatic booleanisSameFile(Path path, Path path2) static Pathmove(Path source, Path target, CopyOption... options) Delegates toFiles.move(Path, Path, CopyOption...)throwingUncheckedIOExceptioninstead ofIOException.static BufferedReadernewBufferedReader(Path path) static BufferedReadernewBufferedReader(Path path, Charset cs) Delegates toFiles.newBufferedReader(Path, Charset)throwingUncheckedIOExceptioninstead ofIOException.static BufferedWriternewBufferedWriter(Path path, Charset cs, OpenOption... options) Delegates toFiles.newBufferedWriter(Path, Charset, OpenOption...)throwingUncheckedIOExceptioninstead ofIOException.static BufferedWriternewBufferedWriter(Path path, OpenOption... options) Delegates toFiles.newBufferedWriter(Path, OpenOption...)throwingUncheckedIOExceptioninstead ofIOException.static SeekableByteChannelnewByteChannel(Path path, OpenOption... options) Delegates toFiles.newByteChannel(Path, OpenOption...)throwingUncheckedIOExceptioninstead ofIOException.static SeekableByteChannelnewByteChannel(Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs) Delegates toFiles.newByteChannel(Path, Set, FileAttribute...)throwingUncheckedIOExceptioninstead ofIOException.static DirectoryStream<Path> newDirectoryStream(Path dir) static DirectoryStream<Path> newDirectoryStream(Path dir, String glob) Delegates toFiles.newDirectoryStream(Path, String)throwingUncheckedIOExceptioninstead ofIOException.static DirectoryStream<Path> newDirectoryStream(Path dir, DirectoryStream.Filter<? super Path> filter) Delegates toFiles.newDirectoryStream(Path, java.nio.file.DirectoryStream.Filter)throwingUncheckedIOExceptioninstead ofIOException.static InputStreamnewInputStream(Path path, OpenOption... options) Delegates toFiles.newInputStream(Path, OpenOption...)throwingUncheckedIOExceptioninstead ofIOException.static OutputStreamnewOutputStream(Path path, OpenOption... options) Delegates toFiles.newOutputStream(Path, OpenOption...)throwingUncheckedIOExceptioninstead ofIOException.static StringprobeContentType(Path path) static byte[]readAllBytes(Path path) readAllLines(Path path) readAllLines(Path path, Charset cs) Delegates toFiles.readAllLines(Path, Charset)throwingUncheckedIOExceptioninstead ofIOException.static <A extends BasicFileAttributes>
AreadAttributes(Path path, Class<A> type, LinkOption... options) Delegates toFiles.readAttributes(Path, Class, LinkOption...)throwingUncheckedIOExceptioninstead ofIOException.readAttributes(Path path, String attributes, LinkOption... options) Delegates toFiles.readAttributes(Path, String, LinkOption...)throwingUncheckedIOExceptioninstead ofIOException.static PathreadSymbolicLink(Path link) static PathsetAttribute(Path path, String attribute, Object value, LinkOption... options) Delegates toFiles.setAttribute(Path, String, Object, LinkOption...)throwingUncheckedIOExceptioninstead ofIOException.static PathsetLastModifiedTime(Path path, FileTime time) Delegates toFiles.setLastModifiedTime(Path, FileTime)throwingUncheckedIOExceptioninstead ofIOException.static PathsetOwner(Path path, UserPrincipal owner) Delegates toFiles.setOwner(Path, UserPrincipal)throwingUncheckedIOExceptioninstead ofIOException.static PathsetPosixFilePermissions(Path path, Set<PosixFilePermission> perms) Delegates toFiles.setPosixFilePermissions(Path, Set)throwingUncheckedIOExceptioninstead ofIOException.static longwalk(Path start, int maxDepth, FileVisitOption... options) Delegates toFiles.walk(Path, int, FileVisitOption...)throwingUncheckedIOExceptioninstead ofIOException.walk(Path start, FileVisitOption... options) Delegates toFiles.walk(Path, FileVisitOption...)throwingUncheckedIOExceptioninstead ofIOException.static PathwalkFileTree(Path start, FileVisitor<? super Path> visitor) Delegates toFiles.walkFileTree(Path, FileVisitor)throwingUncheckedIOExceptioninstead ofIOException.static PathwalkFileTree(Path start, Set<FileVisitOption> options, int maxDepth, FileVisitor<? super Path> visitor) Delegates toFiles.walkFileTree(Path, Set, int, FileVisitor)throwingUncheckedIOExceptioninstead ofIOException.static Pathwrite(Path path, byte[] bytes, OpenOption... options) Delegates toFiles.write(Path, byte[], OpenOption...)throwingUncheckedIOExceptioninstead ofIOException.static Pathwrite(Path path, Iterable<? extends CharSequence> lines, Charset cs, OpenOption... options) Delegates toFiles.write(Path, Iterable, Charset, OpenOption...)throwingUncheckedIOExceptioninstead ofIOException.static Pathwrite(Path path, Iterable<? extends CharSequence> lines, OpenOption... options) Delegates toFiles.write(Path, Iterable, OpenOption...)throwingUncheckedIOExceptioninstead ofIOException.
-
Method Details
-
copy
Delegates toFiles.copy(InputStream, Path, CopyOption...)throwingUncheckedIOExceptioninstead ofIOException.- Parameters:
in- See delegate.target- See delegate.options- See delegate.- Returns:
- See delegate.
- Throws:
UncheckedIOException- Wraps anIOException.- See Also:
-
copy
- Parameters:
source- See delegate. See delegate.out- See delegate. See delegate.- Returns:
- See delegate. See delegate.
- Throws:
UncheckedIOException- Wraps anIOException.
-
copy
Delegates toFiles.copy(Path, Path, CopyOption...)throwingUncheckedIOExceptioninstead ofIOException.- Parameters:
source- See delegate.target- See delegate.options- See delegate.- Returns:
- See delegate.
- Throws:
UncheckedIOException- Wraps anIOException.
-
createDirectories
Delegates toFiles.createDirectories(Path, FileAttribute...)throwingUncheckedIOExceptioninstead ofIOException.- Parameters:
dir- See delegate.attrs- See delegate.- Returns:
- See delegate.
- Throws:
UncheckedIOException- Wraps anIOException.
-
createDirectory
Delegates toFiles.createDirectory(Path, FileAttribute...)throwingUncheckedIOExceptioninstead ofIOException.- Parameters:
dir- See delegate.attrs- See delegate.- Returns:
- See delegate.
- Throws:
UncheckedIOException- Wraps anIOException.
-
createFile
Delegates toFiles.createFile(Path, FileAttribute...)throwingUncheckedIOExceptioninstead ofIOException.- Parameters:
path- See delegate.attrs- See delegate.- Returns:
- See delegate.
- Throws:
UncheckedIOException- Wraps anIOException.
-
createLink
- Parameters:
link- See delegate.existing- See delegate.- Returns:
- See delegate.
- Throws:
UncheckedIOException- Wraps anIOException.
-
createSymbolicLink
Delegates toFiles.createSymbolicLink(Path, Path, FileAttribute...)throwingUncheckedIOExceptioninstead ofIOException.- Parameters:
link- See delegate.target- See delegate.attrs- See delegate.- Returns:
- See delegate.
- Throws:
UncheckedIOException- Wraps anIOException.
-
createTempDirectory
Delegates toFiles.createTempDirectory(Path, String, FileAttribute...)throwingUncheckedIOExceptioninstead ofIOException.- Parameters:
dir- See delegate.prefix- See delegate.attrs- See delegate.- Returns:
- See delegate.
- Throws:
UncheckedIOException- Wraps anIOException.
-
createTempDirectory
Delegates toFiles.createTempDirectory(String, FileAttribute...)throwingUncheckedIOExceptioninstead ofIOException.- Parameters:
prefix- See delegate.attrs- See delegate.- Returns:
- See delegate.
- Throws:
UncheckedIOException- Wraps anIOException.
-
createTempFile
public static Path createTempFile(Path dir, String prefix, String suffix, FileAttribute<?>... attrs) Delegates toFiles.createTempFile(Path, String, String, FileAttribute...)throwingUncheckedIOExceptioninstead ofIOException.- Parameters:
dir- See delegate.prefix- See delegate.suffix- See delegate.attrs- See delegate.- Returns:
- See delegate.
- Throws:
UncheckedIOException- Wraps anIOException.
-
createTempFile
Delegates toFiles.createTempFile(String, String, FileAttribute...)throwingUncheckedIOExceptioninstead ofIOException.- Parameters:
prefix- See delegate.suffix- See delegate.attrs- See delegate.- Returns:
- See delegate.
- Throws:
UncheckedIOException- Wraps anIOException.
-
delete
- Parameters:
path- See delegate.- Throws:
UncheckedIOException- Wraps anIOException.
-
deleteIfExists
- Parameters:
path- See delegate.- Returns:
- See delegate.
- Throws:
UncheckedIOException- Wraps anIOException.
-
find
public static Stream<Path> find(Path start, int maxDepth, BiPredicate<Path, BasicFileAttributes> matcher, FileVisitOption... options) Delegates toFiles.find(Path, int, BiPredicate, FileVisitOption...)throwingUncheckedIOExceptioninstead ofIOException.The returned
Streamwraps aDirectoryStream. When you require timely disposal of file system resources, use atry-with-resources block to ensure invocation of the stream'sBaseStream.close()method after the stream operations are completed.- Parameters:
start- See delegate.maxDepth- See delegate.matcher- See delegate.options- See delegate.- Returns:
- See delegate.
- Throws:
UncheckedIOException- Wraps anIOException.- Since:
- 2.14.0
-
getAttribute
Delegates toFiles.getAttribute(Path, String, LinkOption...)throwingUncheckedIOExceptioninstead ofIOException.- Parameters:
path- See delegate.attribute- See delegate.options- See delegate.- Returns:
- See delegate.
- Throws:
UncheckedIOException- Wraps anIOException.
-
getFileStore
- Parameters:
path- See delegate.- Returns:
- See delegate.
- Throws:
UncheckedIOException- Wraps anIOException.
-
getLastModifiedTime
Delegates toFiles.getLastModifiedTime(Path, LinkOption...)throwingUncheckedIOExceptioninstead ofIOException.- Parameters:
path- See delegate.options- See delegate.- Returns:
- See delegate.
- Throws:
UncheckedIOException- Wraps anIOException.
-
getOwner
Delegates toFiles.getOwner(Path, LinkOption...)throwingUncheckedIOExceptioninstead ofIOException.- Parameters:
path- See delegate.options- See delegate.- Returns:
- See delegate.
- Throws:
UncheckedIOException- Wraps anIOException.
-
getPosixFilePermissions
Delegates toFiles.getPosixFilePermissions(Path, LinkOption...)throwingUncheckedIOExceptioninstead ofIOException.- Parameters:
path- See delegate.options- See delegate.- Returns:
- See delegate.
- Throws:
UncheckedIOException- Wraps anIOException.
-
isHidden
- Parameters:
path- See delegate.- Returns:
- See delegate.
- Throws:
UncheckedIOException- Wraps anIOException.
-
isSameFile
- Parameters:
path- See delegate.path2- See delegate.- Returns:
- See delegate.
- Throws:
UncheckedIOException- Wraps anIOException.
-
lines
Delegates toFiles.lines(Path)throwingUncheckedIOExceptioninstead ofIOException.The returned
Streamwraps aReader. When you require timely disposal of file system resources, use atry-with-resources block to ensure invocation of the stream'sBaseStream.close()method after the stream operations are completed.- Parameters:
path- See delegate.- Returns:
- See delegate.
- Throws:
UncheckedIOException- Wraps anIOException.
-
lines
Delegates toFiles.lines(Path, Charset)throwingUncheckedIOExceptioninstead ofIOException.The returned
Streamwraps aReader. When you require timely disposal of file system resources, use atry-with-resources block to ensure invocation of the stream'sBaseStream.close()method after the stream operations are completed.- Parameters:
path- See delegate.cs- See delegate.- Returns:
- See delegate.
- Throws:
UncheckedIOException- Wraps anIOException.
-
list
Delegates toFiles.list(Path)throwingUncheckedIOExceptioninstead ofIOException.The returned
Streamwraps aDirectoryStream. When you require timely disposal of file system resources, use atry-with-resources block to ensure invocation of the stream'sBaseStream.close()method after the stream operations are completed.- Parameters:
dir- See delegate.- Returns:
- See delegate.
- Throws:
UncheckedIOException- Wraps anIOException.
-
move
Delegates toFiles.move(Path, Path, CopyOption...)throwingUncheckedIOExceptioninstead ofIOException.- Parameters:
source- See delegate.target- See delegate.options- See delegate.- Returns:
- See delegate.
- Throws:
UncheckedIOException- Wraps anIOException.
-
newBufferedReader
- Parameters:
path- See delegate.- Returns:
- See delegate.
- Throws:
UncheckedIOException- Wraps anIOException.
-
newBufferedReader
Delegates toFiles.newBufferedReader(Path, Charset)throwingUncheckedIOExceptioninstead ofIOException.- Parameters:
path- See delegate.cs- See delegate.- Returns:
- See delegate.
- Throws:
UncheckedIOException- Wraps anIOException.
-
newBufferedWriter
Delegates toFiles.newBufferedWriter(Path, Charset, OpenOption...)throwingUncheckedIOExceptioninstead ofIOException.- Parameters:
path- See delegate.cs- See delegate.options- See delegate.- Returns:
- See delegate.
- Throws:
UncheckedIOException- Wraps anIOException.
-
newBufferedWriter
Delegates toFiles.newBufferedWriter(Path, OpenOption...)throwingUncheckedIOExceptioninstead ofIOException.- Parameters:
path- See delegate.options- See delegate.- Returns:
- See delegate.
- Throws:
UncheckedIOException- Wraps anIOException.
-
newByteChannel
Delegates toFiles.newByteChannel(Path, OpenOption...)throwingUncheckedIOExceptioninstead ofIOException.- Parameters:
path- See delegate.options- See delegate.- Returns:
- See delegate.
- Throws:
UncheckedIOException- Wraps anIOException.
-
newByteChannel
public static SeekableByteChannel newByteChannel(Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs) Delegates toFiles.newByteChannel(Path, Set, FileAttribute...)throwingUncheckedIOExceptioninstead ofIOException.- Parameters:
path- See delegate.options- See delegate.attrs- See delegate.- Returns:
- See delegate.
- Throws:
UncheckedIOException- Wraps anIOException.
-
newDirectoryStream
Delegates toFiles.newDirectoryStream(Path)throwingUncheckedIOExceptioninstead ofIOException.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.- Parameters:
dir- See delegate.- Returns:
- See delegate.
-
newDirectoryStream
public static DirectoryStream<Path> newDirectoryStream(Path dir, DirectoryStream.Filter<? super Path> filter) Delegates toFiles.newDirectoryStream(Path, java.nio.file.DirectoryStream.Filter)throwingUncheckedIOExceptioninstead ofIOException.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.- Parameters:
dir- See delegate.filter- See delegate.- Returns:
- See delegate.
-
newDirectoryStream
Delegates toFiles.newDirectoryStream(Path, String)throwingUncheckedIOExceptioninstead ofIOException.The returned
Streamwraps aDirectoryStream. When you require timely disposal of file system resources, use atry-with-resources block to ensure invocation of the stream'sBaseStream.close()method after the stream operations are completed.- Parameters:
dir- See delegate.glob- See delegate.- Returns:
- See delegate.
-
newInputStream
Delegates toFiles.newInputStream(Path, OpenOption...)throwingUncheckedIOExceptioninstead ofIOException.- Parameters:
path- See delegate.options- See delegate.- Returns:
- See delegate.
-
newOutputStream
Delegates toFiles.newOutputStream(Path, OpenOption...)throwingUncheckedIOExceptioninstead ofIOException.- Parameters:
path- See delegate.options- See delegate.- Returns:
- See delegate.
-
probeContentType
- Parameters:
path- See delegate.- Returns:
- See delegate.
-
readAllBytes
- Parameters:
path- See delegate.- Returns:
- See delegate.
-
readAllLines
- Parameters:
path- See delegate.- Returns:
- See delegate.
-
readAllLines
Delegates toFiles.readAllLines(Path, Charset)throwingUncheckedIOExceptioninstead ofIOException.- Parameters:
path- See delegate.cs- See delegate.- Returns:
- See delegate.
-
readAttributes
public static <A extends BasicFileAttributes> A readAttributes(Path path, Class<A> type, LinkOption... options) Delegates toFiles.readAttributes(Path, Class, LinkOption...)throwingUncheckedIOExceptioninstead ofIOException.- Type Parameters:
A- See delegate.- Parameters:
path- See delegate.type- See delegate.options- See delegate.- Returns:
- See delegate.
-
readAttributes
public static Map<String,Object> readAttributes(Path path, String attributes, LinkOption... options) Delegates toFiles.readAttributes(Path, String, LinkOption...)throwingUncheckedIOExceptioninstead ofIOException.- Parameters:
path- See delegate.attributes- See delegate.options- See delegate.- Returns:
- See delegate.
-
readSymbolicLink
- Parameters:
link- See delegate.- Returns:
- See delegate.
-
setAttribute
Delegates toFiles.setAttribute(Path, String, Object, LinkOption...)throwingUncheckedIOExceptioninstead ofIOException.- Parameters:
path- See delegate.attribute- See delegate.value- See delegate.options- See delegate.- Returns:
- See delegate.
-
setLastModifiedTime
Delegates toFiles.setLastModifiedTime(Path, FileTime)throwingUncheckedIOExceptioninstead ofIOException.- Parameters:
path- See delegate.time- See delegate.- Returns:
- See delegate.
-
setOwner
Delegates toFiles.setOwner(Path, UserPrincipal)throwingUncheckedIOExceptioninstead ofIOException.- Parameters:
path- See delegate.owner- See delegate.- Returns:
- See delegate.
-
setPosixFilePermissions
Delegates toFiles.setPosixFilePermissions(Path, Set)throwingUncheckedIOExceptioninstead ofIOException.- Parameters:
path- See delegate.perms- See delegate.- Returns:
- See delegate.
-
size
- Parameters:
path- See delegate.- Returns:
- See delegate.
-
walk
Delegates toFiles.walk(Path, FileVisitOption...)throwingUncheckedIOExceptioninstead ofIOException.The returned
Streammay wrap one or moreDirectoryStreams. When you require timely disposal of file system resources, use atry-with-resources block to ensure invocation of the stream'sBaseStream.close()method after the stream operations are completed. Calling a closed stream causes aIllegalStateException.- Parameters:
start- See delegate.options- See delegate.- Returns:
- See delegate.
-
walk
Delegates toFiles.walk(Path, int, FileVisitOption...)throwingUncheckedIOExceptioninstead ofIOException.The returned
Streammay wrap one or moreDirectoryStreams. When you require timely disposal of file system resources, use atry-with-resources block to ensure invocation of the stream'sBaseStream.close()method after the stream operations are completed. Calling a closed stream causes aIllegalStateException.- Parameters:
start- See delegate.maxDepth- See delegate.options- See delegate.- Returns:
- See delegate.
-
walkFileTree
Delegates toFiles.walkFileTree(Path, FileVisitor)throwingUncheckedIOExceptioninstead ofIOException.- Parameters:
start- See delegate.visitor- See delegate.- Returns:
- See delegate.
-
walkFileTree
public static Path walkFileTree(Path start, Set<FileVisitOption> options, int maxDepth, FileVisitor<? super Path> visitor) Delegates toFiles.walkFileTree(Path, Set, int, FileVisitor)throwingUncheckedIOExceptioninstead ofIOException.- Parameters:
start- See delegate.options- See delegate.maxDepth- See delegate.visitor- See delegate.- Returns:
- See delegate.
-
write
Delegates toFiles.write(Path, byte[], OpenOption...)throwingUncheckedIOExceptioninstead ofIOException.- Parameters:
path- See delegate.bytes- See delegate.options- See delegate.- Returns:
- See delegate.
-
write
public static Path write(Path path, Iterable<? extends CharSequence> lines, Charset cs, OpenOption... options) Delegates toFiles.write(Path, Iterable, Charset, OpenOption...)throwingUncheckedIOExceptioninstead ofIOException.- Parameters:
path- See delegate.lines- See delegate.cs- See delegate.options- See delegate.- Returns:
- See delegate.
-
write
Delegates toFiles.write(Path, Iterable, OpenOption...)throwingUncheckedIOExceptioninstead ofIOException.- Parameters:
path- See delegate.lines- See delegate.options- See delegate.- Returns:
- See delegate.
-