Class FileResourceUtil

java.lang.Object
com.inductiveautomation.ignition.common.fileresources.FileResourceUtil

public final class FileResourceUtil extends Object
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 Details

    • isTextContentType

      public static boolean isTextContentType(String contentType)
      Returns:
      true if contentType denotes textual content that can be surfaced as UTF-8 text. Binary types — images, pdf, zip, application/octet-stream — return false, as does a null content 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 from oldKey to newLeafName so 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 under oldKey.