Class Rename


  • public abstract class Rename
    extends java.lang.Object
    This class is used to rename file names.
    • Field Detail

      • NO_CHANGE

        public static final Rename NO_CHANGE

        A Rename which does not alter the given file name.

        For example, given picture.jpg, result is picture.jpg.

        Note: The apply(String, ThumbnailParameter) method does not use the param parameter. A value of null for param is permitted.

      • PREFIX_DOT_THUMBNAIL

        public static final Rename PREFIX_DOT_THUMBNAIL

        Appends thumbnail. to the beginning of the file name.

        For example, given picture.jpg, result is thumbnail.picture.jpg.

        Note: The apply(String, ThumbnailParameter) method does not use the param parameter. A value of null for param is permitted.

      • PREFIX_HYPTHEN_THUMBNAIL

        @Deprecated
        public static final Rename PREFIX_HYPTHEN_THUMBNAIL
        Deprecated.
        Please use the correctly spelled PREFIX_HYPHEN_THUMBNAIL. This constant will be removed in Thumbnailator 0.5.0.

        Appends thumbnail- to the beginning of the file name.

        For example, given picture.jpg, result is thumbnail-picture.jpg.

        Note: The apply(String, ThumbnailParameter) method does not use the param parameter. A value of null for param is permitted.

      • PREFIX_HYPHEN_THUMBNAIL

        public static final Rename PREFIX_HYPHEN_THUMBNAIL

        Appends thumbnail- to the beginning of the file name.

        For example, given picture.jpg, result is thumbnail-picture.jpg.

        Note: The apply(String, ThumbnailParameter) method does not use the param parameter. A value of null for param is permitted.

      • SUFFIX_DOT_THUMBNAIL

        public static final Rename SUFFIX_DOT_THUMBNAIL

        Appends .thumbnail to the file name prior to the extension of the file.

        For example, given picture.jpg, result is picture.thumbnail.jpg.

        Note: The apply(String, ThumbnailParameter) method does not use the param parameter. A value of null for param is permitted.

      • SUFFIX_HYPTHEN_THUMBNAIL

        @Deprecated
        public static final Rename SUFFIX_HYPTHEN_THUMBNAIL
        Deprecated.
        Please use the correctly spelled SUFFIX_HYPHEN_THUMBNAIL. This constant will be removed in Thumbnailator 0.5.0.

        Appends -thumbnail to the file name prior to the extension of the file.

        For example, given picture.jpg, result is picture-thumbnail.jpg.

        Note: The apply(String, ThumbnailParameter) method does not use the param parameter. A value of null for param is permitted.

      • SUFFIX_HYPHEN_THUMBNAIL

        public static final Rename SUFFIX_HYPHEN_THUMBNAIL

        Appends -thumbnail to the file name prior to the extension of the file.

        For example, given picture.jpg, result is picture-thumbnail.jpg.

        Note: The apply(String, ThumbnailParameter) method does not use the param parameter. A value of null for param is permitted.

    • Constructor Detail

      • Rename

        protected Rename()
        The default constructor is intended only to be called implicitly by the classes implementing the functionality of the Rename class.
    • Method Detail

      • apply

        public abstract java.lang.String apply​(java.lang.String name,
                                               ThumbnailParameter param)
        Applies the function performed by this Rename on the specified name and thumbnail creation parameters.
        Parameters:
        name - Name to apply the function on. The file name should not include the directory in which the file resides in.
        param - Parameters used to create the thumbnail.
        Returns:
        The name after the function has been applied.
      • appendSuffix

        protected java.lang.String appendSuffix​(java.lang.String fileName,
                                                java.lang.String suffix)
        Appends a suffix to a filename.
        Parameters:
        fileName - File name to add a suffix on.
        suffix - The suffix to add.
        Returns:
        File name with specified suffixed affixed.
      • appendPrefix

        protected java.lang.String appendPrefix​(java.lang.String fileName,
                                                java.lang.String prefix)
        Appends a prefix to a filename.
        Parameters:
        fileName - File name to add a prefix on.
        prefix - The prefix to add.
        Returns:
        File name with the specified prefix affixed.