FolderText - ViiSE/papka GitHub Wiki

FolderText

FolderText - implementation to create a folder from a raw list of files (raw full filename list).

Constructors

public FolderText(List<String> rawFiles)


List<String> rawFiles - list of full file names.
public FolderText(String... rawFiles)


String... rawFiles - save varargs of full file names.
public FolderText(Name name, String... rawFiles)


Name name - folder name (default NameFolderRoot);
String... rawFiles - save varargs full file names.
public FolderText(Name name, List<String> rawFiles)


Name name - folder name (default NameFolderRoot);
List<String> rawFiles - list of full file names.
public FolderText(Name name, TreeFolder<String> trFolder)


Name name - folder name (default NameFolderRoot);
TreeFolder<String> trFolder - for building tree folder from full file names (default TreeFolderPure).

Example

Folder<String> folders = new FolderText(
                "/root124",
                "/root1.png",
                "/root2.png",
                "/music/a.mp3",
                "/music/b.mp3",
                "/doc/table.xlsx",);
folders.travel(folder -> {
    System.out.println("Full Name: " + folder.fullName()); 
    System.out.println("Short Name: " + folder.shortName());
    System.out.println("Files:");
    folder.files().forEach(file -> System.out.println("\t" + file));
    System.out.println("Children:");
    folder.children().forEach(child -> System.out.println("\t" + child.shortName()));
    System.out.println();
});
Output:

Full Name: /
Short Name: /
Files:
    root124
    root1.png
    root2.png
Children:
    doc
    music

Full Name: /doc
Short Name: doc
Files:
    table.xlsx
Children:

Full Name: /music
Short Name: music
Files:
    a.mp3
    b.mp3
Children:

Links

Folder - implementable interface.

TreeFolderPure - default value constructor.

NameFolderRoot - default value constructor.

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