PreparedFoldersMapFileWin - ViiSE/papka GitHub Wiki

PreparedFoldersMapFileWin

PreparedFoldersMapFileWin - Prepares folders as Map<String, Folder<File>>, where key is full folder name, and value is the folder with files of Windows.

Constructors

public PreparedFoldersMapFileWin(PreparedFolders<Map<String, List<String>>> prepFolders)

PreparedFolders<Map<String, List<File>>> prepFolders - Prepares folders as Map<String, List<File>>, where key is full folder name, and value is the list of folder files of Windows.
public PreparedFoldersMapFileWin(
        PreparedFolders<Map<String, List<String>>> prepFolders,
        boolean excludeNonExisting)

PreparedFolders<Map<String, List<File>>> prepFolders - Prepares folders as Map<String, List<File>>, where key is full folder name, and value is the list of folder files of Windows;
boolean excludeNonExisting - exclude non-existent files or not (default - false)?
public PreparedFoldersMapFileWin(
        PreparedFolders<Map<String, List<String>>> prepFolders,
        boolean excludeNonExisting,
        boolean isUnixLike)

PreparedFolders<Map<String, List<File>>> prepFolders - Prepares folders as Map<String, List<File>>, where key is full folder name, and value is the list of folder files of Windows;
boolean excludeNonExisting - exclude non-existent files or not (default - false)?
boolean isUnixLike - raw files is unix like or not (default - false)?

Example

List<File> files = new ArrayList<>();
files.add("C:\\Users\\user\\Documents\\file1.txt");
files.add("C:\\Users\\user\\Documents\\file2.txt");
files.add("C:\\Users\\user\\Documents\\root1.txt");
files.add("C:\\Users\\user\\Documents\\root2.txt");
files.add("C:\\Users\\user\\Documents\\root3.txt");
files.add("C:\\Users\\user\\Documents\\folder1\\file1.txt");
files.add("C:\\Users\\user\\Documents\\folder1\\file2.txt");
files.add("C:\\Users\\user\\Documents\\folder2\\file1.txt");

PreparedFolders<Map<String, Folder<File>>> prepFolders = new PreparedFoldersMapFileWin(
         new PreparedFoldersMapFilesRaw(files)
);

Map<String, Folder<File>> mapFile = prepFolders.preparation();
mapFile.forEach((fullFolderName, prFolder) -> {
        System.out.println(fullFolderName);
        Folder<File> folder = prFolder.shortName();
        prFolder.files().forEach(file -> System.out.println("\t" + file.getName()));
    }
);
Output:

/
C:
Users
user
Documents
    file1.txt
    file2.txt
    root1.txt
    root2.txt
    root3.txt
folder1
    file1.txt
    file2.txt
folder2
    file1.txt

Links

PreparedFolders - implementable interface.

⚠️ **GitHub.com Fallback** ⚠️