import java.nio.file.FileSystem; import java.nio.file.Path; import java.util.HashMap; import java.util.Map; public class InMemoryPathFactory { private static final InMemoryFileSystemProvider provider = new InMemoryFileSystemProvider(); private static final InMemoryFileSystem fileSystem = new InMemoryFileSystem(provider); private InMemoryPathFactory() { // Utility class - private constructor } /** * Creates a new in-memory path * * @param path the path string * @return a InMemoryPath that exists only in memory */ public static Path createPath(String path) { return new InMemoryPath(fileSystem, path); } /** * Gets the in-memory file system instance * * @return the file system */ public static FileSystem getFileSystem() { return fileSystem; } /** * Clears all data from the in-memory file system */ public static void clear() { InMemoryFileSystem.getStorage().clear(); } /** * Checks if a path exists in memory * * @param path the path to check * @return true if the path exists */ public static boolean exists(Path path) { return InMemoryFileSystem.getStorage().containsKey(path.toString()); } }