Class GoogleCloudStorageStrings


  • public final class GoogleCloudStorageStrings
    extends Object
    Contains helper methods for standardizing String-matching algorithms specific to GCS.
    • Method Detail

      • matchListPrefix

        public static String matchListPrefix​(String objectNamePrefix,
                                             String objectName,
                                             ListObjectOptions listOptions)
        Helper that mimics the GCS API behavior for taking an existing objectName and checking if it matches a user-supplied prefix with an optional directory "delimiter". If it matches, either the full objectName will be returned unmodified, or the return value will be a String that is a prefix of the objectName inclusive of the matching prefix but truncating any suffix past the first appearance of the delimiter after the full prefix. The returned prefix includes the delimiter String at which the objectName was truncated.
        Parameters:
        objectNamePrefix - The prefix that objectName must match to be returned in any form. May be null; then an objectName will always be returned, just possibly truncated.
        objectName - The name to attempt to match against the prefix and delimiter.
        listOptions - List object options to match list prefix.
        Returns:
        A substring of objectName or the full unaltered objectName after applying GCS matching logic, or null if the supply objectName does not match the provided prefix.