Class FileResourceUtil
java.lang.Object
com.inductiveautomation.ignition.common.fileresources.FileResourceUtil
Static helpers for working with file resource content: classifying a content type as textual, and
keeping a resource's data key aligned with its leaf name.
See FileResourceConstants for the underlying data-key convention — each file resource
stores its bytes under a single data key equal to the resource's leaf name.
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanisTextContentType(String contentType) static voidmoveContent(Resource resource, String oldKey, String newLeafName, ResourceBuilder builder) Moves a file resource's data blob fromoldKeytonewLeafNameso the on-disk file keeps mirroring the resource's leaf name across a create or rename.
-
Method Details
-
isTextContentType
- Returns:
trueifcontentTypedenotes textual content that can be surfaced as UTF-8 text. Binary types — images, pdf, zip,application/octet-stream— returnfalse, as does anullcontent type. This is the single authority shared by the File Resource editor and the@file:prompt assist, so both agree on whether a given file is text.
-
moveContent
public static void moveContent(Resource resource, String oldKey, String newLeafName, ResourceBuilder builder) Moves a file resource's data blob fromoldKeytonewLeafNameso the on-disk file keeps mirroring the resource's leaf name across a create or rename. No-op when the keys match or nothing is stored underoldKey.
-