Class FileAttributes
java.lang.Object
ghidra.formats.gfilesystem.fileinfo.FileAttributes
A collection of
FileAttribute values that describe a file.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(FileAttributeType attributeType, Object attributeValue) Adds a typed file attribute value.voidadd(FileAttributeType attributeType, String displayName, Object attributeValue) Adds a typed file attribute value.voidAdds a custom named file attribute.clone()booleancontains(FileAttributeType attributeType) Returns true if the specified attribute is present.<T> Tget(FileAttributeType attributeType, Class<T> valueClass, T defaultValue) Gets the value of the specified attribute.List<FileAttribute<?>> Return a list of all the attributes added to this instance.static FileAttributesof(FileAttribute<?>... attribs) Creates aFileAttributesinstance containing the specified attribute values.
-
Field Details
-
EMPTY
Read-only empty instance.
-
-
Constructor Details
-
FileAttributes
public FileAttributes()Creates a new / emptyFileAttributesinstance.
-
-
Method Details
-
of
Creates aFileAttributesinstance containing the specified attribute values.- Parameters:
attribs- var-arg list ofFileAttributevalues, null values are ignored and skipped- Returns:
- a new
FileAttributesinstance
-
clone
-
add
Adds a custom named file attribute.The value class should have a reasonable toString() that converts the value to something that is presentable to the user.
- Parameters:
name- name of the attributeattributeValue- value of the attribute
-
add
Adds a typed file attribute value.The value class needs to match
FileAttributeType.getValueType().- Parameters:
attributeType-FileAttributeTypetype of this valueattributeValue- value of attribute
-
add
Adds a typed file attribute value.The value class needs to match
FileAttributeType.getValueType().- Parameters:
attributeType-FileAttributeTypetype of this valuedisplayName- string used to label the value when displayed to the userattributeValue- value of attribute- Throws:
IllegalArgumentException- if attributeValue does not match attributeType'sFileAttributeType.getValueType().
-
get
Gets the value of the specified attribute.- Type Parameters:
T- expected class of the attribute value- Parameters:
attributeType-FileAttributeTypeenum type of attribute to search forvalueClass- java class of the valuedefaultValue- value to return if attribute is not present- Returns:
- value of requested attribute, or defaultValue if not present
-
getAttributes
Return a list of all the attributes added to this instance.- Returns:
- list of
FileAttribute
-
contains
Returns true if the specified attribute is present.- Parameters:
attributeType- attribute to query- Returns:
- boolean true if present
-