nio
11 tutorials tagged “nio”.
- How to Create a File in JavaCreate files in Java with Files.createFile, Files.createTempFile and File.createNewFile, and handle files that already exist or folders that are missing.
- How to Delete, Copy and Move Files in JavaDelete, copy, move and rename files with Files.delete, deleteIfExists, copy and move, using options like REPLACE_EXISTING and ATOMIC_MOVE.
- File Handling in JavaFile handling means creating, reading, writing and managing files. Learn the two Java APIs, java.io.File and NIO.2 Path and Files, and which to use.
- Memory-Mapped Files in JavaMemory-mapped files let a program read and write a file as if it were memory, using FileChannel.map and MappedByteBuffer. Learn how and when to use them.
- NIO Buffers and ChannelsChannels move data in blocks between files and ByteBuffers. Learn position, limit and flip, FileChannel reads and writes, and fast transferTo copies.
- NIO.2 Path and Files ClassesPath represents a file system location and Files performs operations on it. Learn how to build, join, normalize and inspect paths and the main Files methods.
- Path vs File in Javajava.nio.file.Path vs java.io.File: error handling, features, symbolic links, performance and how to convert between them, with side-by-side examples.
- How to Read a File in JavaRead files with Files.readString, readAllLines, lines and newBufferedReader. Learn which method suits small files, large files and binary data.
- WatchService in JavaWatchService notifies a program when files in a folder are created, changed or deleted. Learn how to register a folder, wait for events and process them.
- Working with Directories in JavaCreate, list, walk, search and delete folders with Files.createDirectories, list, walk, find and newDirectoryStream, including deleting a folder tree.