mirror of
https://github.com/Maschell/JNUSLib.git
synced 2024-11-22 07:59:19 +01:00
[NUSTitle] Added functions getAllFSTEntriesAsStream and getAllFSTEntryChildrenAsStream
This commit is contained in:
parent
9b179f51a6
commit
43d9d6f5cc
@ -26,6 +26,7 @@ import java.util.Optional;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import de.mas.wiiu.jnus.entities.TMD;
|
||||
import de.mas.wiiu.jnus.entities.Ticket;
|
||||
@ -66,6 +67,25 @@ public class NUSTitle {
|
||||
return getFSTEntriesFlatByContents(new ArrayList<Content>(getTMD().getAllContents().values()));
|
||||
}
|
||||
|
||||
public Stream<FSTEntry> getAllFSTEntriesAsStream() {
|
||||
return getAllFSTEntryChildrenAsStream(FST.getRoot());
|
||||
}
|
||||
|
||||
public Stream<FSTEntry> getAllFSTEntryChildrenAsStream(FSTEntry cur) {
|
||||
return getAllFSTEntryChildrenAsStream(cur, false);
|
||||
}
|
||||
|
||||
public Stream<FSTEntry> getAllFSTEntryChildrenAsStream(FSTEntry cur, boolean allowNotInPackage) {
|
||||
return cur.getChildren().stream() //
|
||||
.filter(e -> allowNotInPackage || !e.isNotInPackage()) //
|
||||
.flatMap(e -> {
|
||||
if (!e.isDir()) {
|
||||
return Stream.empty();
|
||||
}
|
||||
return getAllFSTEntryChildrenAsStream(e, allowNotInPackage);
|
||||
});
|
||||
}
|
||||
|
||||
public FSTEntry getFSTEntryByFullPath(String givenFullPath) {
|
||||
String fullPath = givenFullPath.replace("/", File.separator);
|
||||
if (!fullPath.startsWith(File.separator)) {
|
||||
|
Loading…
Reference in New Issue
Block a user