Class ResourceUtil
java.lang.Object
com.inductiveautomation.ignition.common.util.ResourceUtil
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Filenames that are reserved for use by the Windows OS, and will cause errors if you attempt to create them on the filesystem.static final Comparator<Resource>
static final String
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> T
decodeOrCreate
(Resource r, XMLDeserializer deserializer, Class<T> clazz, LoggerEx log) static <T> T
decodeOrNull
(byte[] data, XMLDeserializer deserializer, Class<T> clazz) static <T> T
decodeOrNull
(Resource r, XMLDeserializer deserializer, Class<T> clazz) static String
Uses URL encoding to escape illegal characters in a resource name, so that the name can be used as a filename, according to the following logic: If the name is a reserved name like COM3, all characters are replaced by their %XX hex If the name contains a percent sign, it is replaced by %25 If the name contains two dots in a row, they are replaced by %2E%2E If the name ends with a dot, it is replaced by %2E If the name ends with a space, it is replaced by %20 If the name starts with a space, it is replaced by %20 For each illegal character, it is replaced by %XX its hex encoding.static String
static ResourceSignature
getTrueSignature
(Resource resource) Returns the signature of the resource for the resource collection in which it is defined, rather than the resource collection it was loaded into.static String
getValidFolderName
(String folderName) static boolean
static boolean
isLegalName
(String proposedName) static String
static String
Decodes a URL-encoded resource name, replacing %XX hex codes with their corresponding characters.
-
Field Details
-
INVALID_WINDOWS_FILENAMES
Filenames that are reserved for use by the Windows OS, and will cause errors if you attempt to create them on the filesystem. -
SORT_BY_MOST_RECENT
-
ENABLED_KEY
- See Also:
-
UUID_KEY
- See Also:
-
-
Method Details
-
getResourceName
-
subPath
- Returns:
- the
ResourcePath.getPath()
of the resource, or null if the resource was null.
-
decodeOrCreate
public static <T> T decodeOrCreate(Resource r, XMLDeserializer deserializer, Class<T> clazz, LoggerEx log) throws Exception - Throws:
Exception
-
decodeOrNull
@Nullable public static <T> T decodeOrNull(Resource r, XMLDeserializer deserializer, Class<T> clazz) throws Exception - Throws:
Exception
-
decodeOrNull
@Nullable public static <T> T decodeOrNull(byte[] data, XMLDeserializer deserializer, Class<T> clazz) throws Exception - Throws:
Exception
-
getValidFolderName
-
isLegalName
- Returns:
true
if this resource name is valid for all supported filesystems
-
escapeIllegalCharacters
Uses URL encoding to escape illegal characters in a resource name, so that the name can be used as a filename, according to the following logic:- If the name is a reserved name like COM3, all characters are replaced by their %XX hex
- If the name contains a percent sign, it is replaced by %25
- If the name contains two dots in a row, they are replaced by %2E%2E
- If the name ends with a dot, it is replaced by %2E
- If the name ends with a space, it is replaced by %20
- If the name starts with a space, it is replaced by %20
- For each illegal character, it is replaced by %XX its hex encoding. Illegal characters are: /, ?, \, *, :, |, ", <, >
-
unescapeIllegalCharacters
Decodes a URL-encoded resource name, replacing %XX hex codes with their corresponding characters. -
getTrueSignature
Returns the signature of the resource for the resource collection in which it is defined, rather than the resource collection it was loaded into. -
isEnabled
- Returns:
- the "enabled" value of the resource, which is a synthetic property stored in the attribute map with the key "enabled" a default-if-absent value of true.
-
getUuid
-