Class FilesUncheck
- Since:
- 2.12.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic long
copy
(InputStream in, Path target, CopyOption... options) Delegates toFiles.copy(InputStream, Path, CopyOption...)
throwingUncheckedIOException
instead ofIOException
.static long
copy
(Path source, OutputStream out) static Path
copy
(Path source, Path target, CopyOption... options) Delegates toFiles.copy(Path, Path, CopyOption...)
throwingUncheckedIOException
instead ofIOException
.static Path
createDirectories
(Path dir, FileAttribute<?>... attrs) Delegates toFiles.createDirectories(Path, FileAttribute...)
throwingUncheckedIOException
instead ofIOException
.static Path
createDirectory
(Path dir, FileAttribute<?>... attrs) Delegates toFiles.createDirectory(Path, FileAttribute...)
throwingUncheckedIOException
instead ofIOException
.static Path
createFile
(Path path, FileAttribute<?>... attrs) Delegates toFiles.createFile(Path, FileAttribute...)
throwingUncheckedIOException
instead ofIOException
.static Path
createLink
(Path link, Path existing) static Path
createSymbolicLink
(Path link, Path target, FileAttribute<?>... attrs) Delegates toFiles.createSymbolicLink(Path, Path, FileAttribute...)
throwingUncheckedIOException
instead ofIOException
.static Path
createTempDirectory
(String prefix, FileAttribute<?>... attrs) Delegates toFiles.createTempDirectory(String, FileAttribute...)
throwingUncheckedIOException
instead ofIOException
.static Path
createTempDirectory
(Path dir, String prefix, FileAttribute<?>... attrs) Delegates toFiles.createTempDirectory(Path, String, FileAttribute...)
throwingUncheckedIOException
instead ofIOException
.static Path
createTempFile
(String prefix, String suffix, FileAttribute<?>... attrs) Delegates toFiles.createTempFile(String, String, FileAttribute...)
throwingUncheckedIOException
instead ofIOException
.static Path
createTempFile
(Path dir, String prefix, String suffix, FileAttribute<?>... attrs) Delegates toFiles.createTempFile(Path, String, String, FileAttribute...)
throwingUncheckedIOException
instead ofIOException
.static void
static boolean
deleteIfExists
(Path path) find
(Path start, int maxDepth, BiPredicate<Path, BasicFileAttributes> matcher, FileVisitOption... options) Delegates toFiles.find(Path, int, BiPredicate, FileVisitOption...)
throwingUncheckedIOException
instead ofIOException
.static Object
getAttribute
(Path path, String attribute, LinkOption... options) Delegates toFiles.getAttribute(Path, String, LinkOption...)
throwingUncheckedIOException
instead ofIOException
.static FileStore
getFileStore
(Path path) static FileTime
getLastModifiedTime
(Path path, LinkOption... options) Delegates toFiles.getLastModifiedTime(Path, LinkOption...)
throwingUncheckedIOException
instead ofIOException
.static UserPrincipal
getOwner
(Path path, LinkOption... options) Delegates toFiles.getOwner(Path, LinkOption...)
throwingUncheckedIOException
instead ofIOException
.static Set<PosixFilePermission>
getPosixFilePermissions
(Path path, LinkOption... options) Delegates toFiles.getPosixFilePermissions(Path, LinkOption...)
throwingUncheckedIOException
instead ofIOException
.static boolean
static boolean
isSameFile
(Path path, Path path2) static Path
move
(Path source, Path target, CopyOption... options) Delegates toFiles.move(Path, Path, CopyOption...)
throwingUncheckedIOException
instead ofIOException
.static BufferedReader
newBufferedReader
(Path path) static BufferedReader
newBufferedReader
(Path path, Charset cs) Delegates toFiles.newBufferedReader(Path, Charset)
throwingUncheckedIOException
instead ofIOException
.static BufferedWriter
newBufferedWriter
(Path path, Charset cs, OpenOption... options) Delegates toFiles.newBufferedWriter(Path, Charset, OpenOption...)
throwingUncheckedIOException
instead ofIOException
.static BufferedWriter
newBufferedWriter
(Path path, OpenOption... options) Delegates toFiles.newBufferedWriter(Path, OpenOption...)
throwingUncheckedIOException
instead ofIOException
.static SeekableByteChannel
newByteChannel
(Path path, OpenOption... options) Delegates toFiles.newByteChannel(Path, OpenOption...)
throwingUncheckedIOException
instead ofIOException
.static SeekableByteChannel
newByteChannel
(Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs) Delegates toFiles.newByteChannel(Path, Set, FileAttribute...)
throwingUncheckedIOException
instead ofIOException
.static DirectoryStream<Path>
newDirectoryStream
(Path dir) static DirectoryStream<Path>
newDirectoryStream
(Path dir, String glob) Delegates toFiles.newDirectoryStream(Path, String)
throwingUncheckedIOException
instead ofIOException
.static DirectoryStream<Path>
newDirectoryStream
(Path dir, DirectoryStream.Filter<? super Path> filter) Delegates toFiles.newDirectoryStream(Path, java.nio.file.DirectoryStream.Filter)
throwingUncheckedIOException
instead ofIOException
.static InputStream
newInputStream
(Path path, OpenOption... options) Delegates toFiles.newInputStream(Path, OpenOption...)
throwingUncheckedIOException
instead ofIOException
.static OutputStream
newOutputStream
(Path path, OpenOption... options) Delegates toFiles.newOutputStream(Path, OpenOption...)
throwingUncheckedIOException
instead ofIOException
.static String
probeContentType
(Path path) static byte[]
readAllBytes
(Path path) readAllLines
(Path path) readAllLines
(Path path, Charset cs) Delegates toFiles.readAllLines(Path, Charset)
throwingUncheckedIOException
instead ofIOException
.static <A extends BasicFileAttributes>
AreadAttributes
(Path path, Class<A> type, LinkOption... options) Delegates toFiles.readAttributes(Path, Class, LinkOption...)
throwingUncheckedIOException
instead ofIOException
.readAttributes
(Path path, String attributes, LinkOption... options) Delegates toFiles.readAttributes(Path, String, LinkOption...)
throwingUncheckedIOException
instead ofIOException
.static Path
readSymbolicLink
(Path link) static Path
setAttribute
(Path path, String attribute, Object value, LinkOption... options) Delegates toFiles.setAttribute(Path, String, Object, LinkOption...)
throwingUncheckedIOException
instead ofIOException
.static Path
setLastModifiedTime
(Path path, FileTime time) Delegates toFiles.setLastModifiedTime(Path, FileTime)
throwingUncheckedIOException
instead ofIOException
.static Path
setOwner
(Path path, UserPrincipal owner) Delegates toFiles.setOwner(Path, UserPrincipal)
throwingUncheckedIOException
instead ofIOException
.static Path
setPosixFilePermissions
(Path path, Set<PosixFilePermission> perms) Delegates toFiles.setPosixFilePermissions(Path, Set)
throwingUncheckedIOException
instead ofIOException
.static long
walk
(Path start, int maxDepth, FileVisitOption... options) Delegates toFiles.walk(Path, int, FileVisitOption...)
throwingUncheckedIOException
instead ofIOException
.walk
(Path start, FileVisitOption... options) Delegates toFiles.walk(Path, FileVisitOption...)
throwingUncheckedIOException
instead ofIOException
.static Path
walkFileTree
(Path start, FileVisitor<? super Path> visitor) Delegates toFiles.walkFileTree(Path, FileVisitor)
throwingUncheckedIOException
instead ofIOException
.static Path
walkFileTree
(Path start, Set<FileVisitOption> options, int maxDepth, FileVisitor<? super Path> visitor) Delegates toFiles.walkFileTree(Path, Set, int, FileVisitor)
throwingUncheckedIOException
instead ofIOException
.static Path
write
(Path path, byte[] bytes, OpenOption... options) Delegates toFiles.write(Path, byte[], OpenOption...)
throwingUncheckedIOException
instead ofIOException
.static Path
write
(Path path, Iterable<? extends CharSequence> lines, Charset cs, OpenOption... options) Delegates toFiles.write(Path, Iterable, Charset, OpenOption...)
throwingUncheckedIOException
instead ofIOException
.static Path
write
(Path path, Iterable<? extends CharSequence> lines, OpenOption... options) Delegates toFiles.write(Path, Iterable, OpenOption...)
throwingUncheckedIOException
instead ofIOException
.
-
Method Details
-
copy
Delegates toFiles.copy(InputStream, Path, CopyOption...)
throwingUncheckedIOException
instead 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...)
throwingUncheckedIOException
instead ofIOException
.- Parameters:
source
- See delegate.target
- See delegate.options
- See delegate.- Returns:
- See delegate.
- Throws:
UncheckedIOException
- Wraps anIOException
.
-
createDirectories
Delegates toFiles.createDirectories(Path, FileAttribute...)
throwingUncheckedIOException
instead ofIOException
.- Parameters:
dir
- See delegate.attrs
- See delegate.- Returns:
- See delegate.
- Throws:
UncheckedIOException
- Wraps anIOException
.
-
createDirectory
Delegates toFiles.createDirectory(Path, FileAttribute...)
throwingUncheckedIOException
instead ofIOException
.- Parameters:
dir
- See delegate.attrs
- See delegate.- Returns:
- See delegate.
- Throws:
UncheckedIOException
- Wraps anIOException
.
-
createFile
Delegates toFiles.createFile(Path, FileAttribute...)
throwingUncheckedIOException
instead 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...)
throwingUncheckedIOException
instead 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...)
throwingUncheckedIOException
instead ofIOException
.- Parameters:
dir
- See delegate.prefix
- See delegate.attrs
- See delegate.- Returns:
- See delegate.
- Throws:
UncheckedIOException
- Wraps anIOException
.
-
createTempDirectory
Delegates toFiles.createTempDirectory(String, FileAttribute...)
throwingUncheckedIOException
instead 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...)
throwingUncheckedIOException
instead 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...)
throwingUncheckedIOException
instead 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...)
throwingUncheckedIOException
instead ofIOException
.The returned
Stream
wraps 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...)
throwingUncheckedIOException
instead 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...)
throwingUncheckedIOException
instead ofIOException
.- Parameters:
path
- See delegate.options
- See delegate.- Returns:
- See delegate.
- Throws:
UncheckedIOException
- Wraps anIOException
.
-
getOwner
Delegates toFiles.getOwner(Path, LinkOption...)
throwingUncheckedIOException
instead ofIOException
.- Parameters:
path
- See delegate.options
- See delegate.- Returns:
- See delegate.
- Throws:
UncheckedIOException
- Wraps anIOException
.
-
getPosixFilePermissions
Delegates toFiles.getPosixFilePermissions(Path, LinkOption...)
throwingUncheckedIOException
instead 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)
throwingUncheckedIOException
instead ofIOException
.The returned
Stream
wraps 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)
throwingUncheckedIOException
instead ofIOException
.The returned
Stream
wraps 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)
throwingUncheckedIOException
instead ofIOException
.The returned
Stream
wraps 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...)
throwingUncheckedIOException
instead 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)
throwingUncheckedIOException
instead ofIOException
.- Parameters:
path
- See delegate.cs
- See delegate.- Returns:
- See delegate.
- Throws:
UncheckedIOException
- Wraps anIOException
.
-
newBufferedWriter
Delegates toFiles.newBufferedWriter(Path, Charset, OpenOption...)
throwingUncheckedIOException
instead ofIOException
.- Parameters:
path
- See delegate.cs
- See delegate.options
- See delegate.- Returns:
- See delegate.
- Throws:
UncheckedIOException
- Wraps anIOException
.
-
newBufferedWriter
Delegates toFiles.newBufferedWriter(Path, OpenOption...)
throwingUncheckedIOException
instead ofIOException
.- Parameters:
path
- See delegate.options
- See delegate.- Returns:
- See delegate.
- Throws:
UncheckedIOException
- Wraps anIOException
.
-
newByteChannel
Delegates toFiles.newByteChannel(Path, OpenOption...)
throwingUncheckedIOException
instead 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...)
throwingUncheckedIOException
instead ofIOException
.- Parameters:
path
- See delegate.options
- See delegate.attrs
- See delegate.- Returns:
- See delegate.
- Throws:
UncheckedIOException
- Wraps anIOException
.
-
newDirectoryStream
Delegates toFiles.newDirectoryStream(Path)
throwingUncheckedIOException
instead 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)
throwingUncheckedIOException
instead 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)
throwingUncheckedIOException
instead ofIOException
.The returned
Stream
wraps 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...)
throwingUncheckedIOException
instead ofIOException
.- Parameters:
path
- See delegate.options
- See delegate.- Returns:
- See delegate.
-
newOutputStream
Delegates toFiles.newOutputStream(Path, OpenOption...)
throwingUncheckedIOException
instead 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)
throwingUncheckedIOException
instead 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...)
throwingUncheckedIOException
instead 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...)
throwingUncheckedIOException
instead 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...)
throwingUncheckedIOException
instead ofIOException
.- Parameters:
path
- See delegate.attribute
- See delegate.value
- See delegate.options
- See delegate.- Returns:
- See delegate.
-
setLastModifiedTime
Delegates toFiles.setLastModifiedTime(Path, FileTime)
throwingUncheckedIOException
instead ofIOException
.- Parameters:
path
- See delegate.time
- See delegate.- Returns:
- See delegate.
-
setOwner
Delegates toFiles.setOwner(Path, UserPrincipal)
throwingUncheckedIOException
instead ofIOException
.- Parameters:
path
- See delegate.owner
- See delegate.- Returns:
- See delegate.
-
setPosixFilePermissions
Delegates toFiles.setPosixFilePermissions(Path, Set)
throwingUncheckedIOException
instead 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...)
throwingUncheckedIOException
instead ofIOException
.The returned
Stream
may wrap one or moreDirectoryStream
s. 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...)
throwingUncheckedIOException
instead ofIOException
.The returned
Stream
may wrap one or moreDirectoryStream
s. 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)
throwingUncheckedIOException
instead 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)
throwingUncheckedIOException
instead ofIOException
.- Parameters:
start
- See delegate.options
- See delegate.maxDepth
- See delegate.visitor
- See delegate.- Returns:
- See delegate.
-
write
Delegates toFiles.write(Path, byte[], OpenOption...)
throwingUncheckedIOException
instead 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...)
throwingUncheckedIOException
instead ofIOException
.- Parameters:
path
- See delegate.lines
- See delegate.cs
- See delegate.options
- See delegate.- Returns:
- See delegate.
-
write
Delegates toFiles.write(Path, Iterable, OpenOption...)
throwingUncheckedIOException
instead ofIOException
.- Parameters:
path
- See delegate.lines
- See delegate.options
- See delegate.- Returns:
- See delegate.
-