Package 

Class StringExtensionsKt

    • Method Summary

      Modifier and Type Method Description
      final Regex getSTREAM_CDN_HOST_PATTERN() Matches the default Stream CDN hosts (imgix and stream-io-cdn).
      final static Boolean isStreamCdnHosted(String $self, String cdnHost) Returns whether this URL is served from a Stream CDN host that understands resizing query parameters.
      final static String snakeToLowerCamelCase(String $self) Converts string written in snake case to String in camel case with the first symbol in lower case.
      final static String lowerCamelCaseToGetter(String $self) Converts a string written in lower camel case to a getter method name.
      final static Pair<String, String> cidToTypeAndId(String $self) Parses CID of channel to channelType and channelId.
      final static StreamCdnOriginalImageDimensions getStreamCdnHostedImageDimensions(String $self) Returns StreamCdnOriginalImageDimensions if the image is hosted by Stream's CDN and is resizable, otherwise returns null.
      final static String createResizedStreamCdnImageUrl(String $self, @FloatRange(from = 0.0.toDouble(), to = 1.0.toDouble(), fromInclusive = false) Float resizedWidthPercentage, @FloatRange(from = 0.0.toDouble(), to = 1.0.toDouble(), fromInclusive = false) Float resizedHeightPercentage, StreamCdnResizeImageMode resizeMode, StreamCdnCropImageMode cropMode) Generates a string URL with Stream CDN image resizing query parameters added to it.
      final static String createResizedStreamCdnImageUrl(String $self, Long maxImagePixels, StreamCdnResizeImageMode resizeMode, StreamCdnCropImageMode cropMode, String cdnHost) Generates a URL with Stream CDN resizing parameters that cap the image to maxImagePixels total pixels (width × height), preserving aspect ratio and never upscaling.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getSTREAM_CDN_HOST_PATTERN

         final Regex getSTREAM_CDN_HOST_PATTERN()

        Matches the default Stream CDN hosts (imgix and stream-io-cdn). Shared with AttachmentHelper so the two can't drift. Anchored on the host only — resizing of custom/proxied Stream CDN domains is opted into via the cdnHost parameter of createResizedStreamCdnImageUrl.

      • isStreamCdnHosted

         final static Boolean isStreamCdnHosted(String $self, String cdnHost)

        Returns whether this URL is served from a Stream CDN host that understands resizing query parameters.

        Parameters:
        cdnHost - An optional custom Stream CDN host (e.g.
      • snakeToLowerCamelCase

         final static String snakeToLowerCamelCase(String $self)

        Converts string written in snake case to String in camel case with the first symbol in lower case. For example string "created_at_some_time" is converted to "createdAtSomeTime".

      • lowerCamelCaseToGetter

         final static String lowerCamelCaseToGetter(String $self)

        Converts a string written in lower camel case to a getter method name. Ex: "camelCase" -> "getCamelCase".

      • getStreamCdnHostedImageDimensions

         final static StreamCdnOriginalImageDimensions getStreamCdnHostedImageDimensions(String $self)

        Returns StreamCdnOriginalImageDimensions if the image is hosted by Stream's CDN and is resizable, otherwise returns null.

      • createResizedStreamCdnImageUrl

         final static String createResizedStreamCdnImageUrl(String $self, @FloatRange(from = 0.0.toDouble(), to = 1.0.toDouble(), fromInclusive = false) Float resizedWidthPercentage, @FloatRange(from = 0.0.toDouble(), to = 1.0.toDouble(), fromInclusive = false) Float resizedHeightPercentage, StreamCdnResizeImageMode resizeMode, StreamCdnCropImageMode cropMode)

        Generates a string URL with Stream CDN image resizing query parameters added to it. Once this URL is called, Stream's CDN will generate a resized image which is accessible using the link returned by this function.

        Parameters:
        resizedWidthPercentage - The percentage of the original image width the resized image width will be.
        resizedHeightPercentage - The percentage of the original image height the resized image height will be.
        resizeMode - Sets the image resizing mode.
        cropMode - Sets the image crop mode.
      • createResizedStreamCdnImageUrl

         final static String createResizedStreamCdnImageUrl(String $self, Long maxImagePixels, StreamCdnResizeImageMode resizeMode, StreamCdnCropImageMode cropMode, String cdnHost)

        Generates a URL with Stream CDN resizing parameters that cap the image to maxImagePixels total pixels (width × height), preserving aspect ratio and never upscaling. Only affects images served from a Stream CDN host (see cdnHost) that carry original width (ow) and height (oh) params; any other URL, or one already at/under the budget, is returned unchanged.

        Parameters:
        cdnHost - An optional custom Stream CDN host to resize in addition to the default Stream CDN hosts, for integrations serving Stream images from a proxied or custom domain.