Code Explainers

Code explainers tagged #nio

java
public List<Path> expandGlob(Path baseDir, String glob) throws IOException {
    FileSystem fs = baseDir.getFileSystem();
    PathMatcher matcher = fs.getPathMatcher("glob:" + glob);
    boolean recursive = glob.contains("**");

Expanding glob patterns with NIO

glob-matching nio streams
Intermediate 5 steps
java
package com.example.fs;
 
import java.io.IOException;
import java.nio.file.FileSystems;

Watching a directory with Java NIO

file-io event-loop resource-management
Intermediate 8 steps