VFSJFileChooser is an open-source Java Swing component designed to replace the standard JFileChooser. It allows developers to integrate seamless browsing for both local and remote filesystems within a single, uniform Graphical User Interface (GUI). Core Capabilities
Virtual File System Abstraction: Built entirely on top of the Apache Commons VFS library, it treats local paths, network connections, and compressed archives identically.
Multi-Protocol Support: Users can navigate local folders alongside remote directories using protocols like FTP, SFTP, WebDAV, and SMB/CIFS.
Archive Exploration: It can drill directly into local or remote archive formats (like .zip, .tar, or .jar files) as if they were standard folders.
Bookmark Management: Includes a built-in sidebar where users can save and manage bookmarks for frequently accessed remote locations. Why Developers Use It
Unified API: Instead of writing separate network code for downloading files, you can treat remote assets exactly like local paths using a unified FileObject.
Fixes Windows Freezes: Standard Java JFileChooser components are notorious for temporary UI “freezes” on Windows machines when querying disconnected network drives; forks like vfsjfilechooser2 on GitHub address this specific bug.
Familiar Experience: It looks and behaves almost identically to javax.swing.JFileChooser, minimizing the learning curve for end users. Basic Code Implementation
Unlike traditional file choosers that yield a standard java.io.File, VFSJFileChooser handles selections as an Apache Commons FileObject:
// Initialize the file chooser final VFSJFileChooser fileChooser = new VFSJFileChooser(); // Display the open dialog overlay RETURN_TYPE answer = fileChooser.showOpenDialog(null); // Validate and process the selection if (answer == RETURN_TYPE.APPROVE) { // Get the generic virtual file object FileObject remoteOrLocalFile = fileChooser.getSelectedFile(); // Safely extract input streams without writing protocol-specific code InputStream is = VFSUtils.getInputStream(remoteOrLocalFile); } Use code with caution. Current Project Status Welcome to VFSJFileChooser website
Leave a Reply