Please enable JavaScript.
Coggle requires JavaScript to display documents.
File I/O (File (class) (operations (checking (.exists(), .notExists(), …
File I/O
File (class)
static methods for file / directory
reading
writing
modifying
close methods
operations
checking
.exists()
.notExists()
.isReadable()
.isWrittable()
.isExecutable()
.isSameFile()
deleting
.delete()
.deleteIfExists()
copying
.copy()
moving
.move()
attributes
.readAttributes()
.creationTime()
.lastAccessTime()
.lastModifiedTime()
.size()
reading / writing
.readAllBytes()
.write()
.newBufferedReader()
.newBufferedWriter()
shortcut of I/O Stream
.newInputStream()
.newOutputStream()
shoftcut of I/O Stream
creating
.createFile()
.createTempFile()
directory
.createDirectory()
DirectoryStream()
show all files in dir
.walktFileTree()
FileVisitor
(interface)
visitor design pattern
find files
PathMatcher.matchers(filename)
.newWatchService()
watch directory for changes
channel
buffer at a time
ByteChannel
(interface)
SeekableByteChannel
(class)
FileChannel
(class)
Buffer
used by channels
has different types
for each primitive type
Path (class)
represents path in filesystem
operations
get info
.getName()
.getNameCount()
.subPath()
.getParent()
.getRoot()
.getFileName()
get path
FileSystem.getDefault().getPath("/tmp")
Paths.get("/tmp")
convert path
.toUri()
browsers
.toAbsoutPath()
file may not exist
.toRealPath()
file must exist
join path
.resolve()
compare
.equals()
.startsWith()
.compareTo()
java.nio.file