Merge remote-tracking branch 'origin/GP-6503_dev747368_improve_yaffs2_logic'

This commit is contained in:
Ryan Kurtz
2026-03-11 05:17:24 -04:00
13 changed files with 629 additions and 1059 deletions
@@ -168,17 +168,25 @@ public class GetInfoFSBFileHandler implements FSBFileHandler {
//---------------------------------------------------------------------------------------------
private static final Function<Object, String> PLAIN_TOSTRING = o -> o.toString();
private static final Function<Object, String> SIZE_TOSTRING =
o -> (o instanceof Long) ? FSUtilities.formatSize((Long) o) : o.toString();
o -> (o instanceof Long l) ? FSUtilities.formatSize(l) : o.toString();
private static final Function<Object, String> UNIX_ACL_TOSTRING =
o -> (o instanceof Number) ? String.format("%05o", (Number) o) : o.toString();
o -> (o instanceof Number num) ? String.format("%05o", num) : o.toString();
private static final Function<Object, String> DATE_TOSTRING =
o -> (o instanceof Date) ? FSUtilities.formatFSTimestamp((Date) o) : o.toString();
o -> (o instanceof Date date) ? FSUtilities.formatFSTimestamp(date) : o.toString();
private static final Function<Object, String> FSRL_TOSTRING =
o -> (o instanceof FSRL) ? ((FSRL) o).toPrettyString().replace("|", "|\n\t") : o.toString();
o -> (o instanceof FSRL fsrl) ? fsrl.toPrettyString().replace("|", "|\n\t") : o.toString();
//@formatter:off
// predefined type-to-string mappings
private static final Map<FileAttributeType, Function<Object, String>> FAT_TOSTRING_FUNCS =
Map.ofEntries(entry(FSRL_ATTR, FSRL_TOSTRING), entry(SIZE_ATTR, SIZE_TOSTRING),
entry(COMPRESSED_SIZE_ATTR, SIZE_TOSTRING), entry(CREATE_DATE_ATTR, DATE_TOSTRING),
entry(MODIFIED_DATE_ATTR, DATE_TOSTRING), entry(ACCESSED_DATE_ATTR, DATE_TOSTRING),
entry(UNIX_ACL_ATTR, UNIX_ACL_TOSTRING));
Map.ofEntries(
entry(FSRL_ATTR, FSRL_TOSTRING),
entry(SIZE_ATTR, SIZE_TOSTRING),
entry(COMPRESSED_SIZE_ATTR, SIZE_TOSTRING),
entry(CREATE_DATE_ATTR, DATE_TOSTRING),
entry(MODIFIED_DATE_ATTR, DATE_TOSTRING),
entry(ACCESSED_DATE_ATTR, DATE_TOSTRING),
entry(UNIX_ACL_ATTR, UNIX_ACL_TOSTRING)
);
//@formatter:on
}