Class Rename
- java.lang.Object
-
- net.coobird.thumbnailator.name.Rename
-
public abstract class Rename extends java.lang.ObjectThis class is used to rename file names.
-
-
Field Summary
Fields Modifier and Type Field Description static RenameNO_CHANGEARenamewhich does not alter the given file name.static RenamePREFIX_DOT_THUMBNAILAppendsthumbnail.to the beginning of the file name.static RenamePREFIX_HYPHEN_THUMBNAILAppendsthumbnail-to the beginning of the file name.static RenamePREFIX_HYPTHEN_THUMBNAILDeprecated.Please use the correctly spelledPREFIX_HYPHEN_THUMBNAIL.static RenameSUFFIX_DOT_THUMBNAILAppends.thumbnailto the file name prior to the extension of the file.static RenameSUFFIX_HYPHEN_THUMBNAILAppends-thumbnailto the file name prior to the extension of the file.static RenameSUFFIX_HYPTHEN_THUMBNAILDeprecated.Please use the correctly spelledSUFFIX_HYPHEN_THUMBNAIL.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected java.lang.StringappendPrefix(java.lang.String fileName, java.lang.String prefix)Appends a prefix to a filename.protected java.lang.StringappendSuffix(java.lang.String fileName, java.lang.String suffix)Appends a suffix to a filename.abstract java.lang.Stringapply(java.lang.String name, ThumbnailParameter param)Applies the function performed by thisRenameon the specified name and thumbnail creation parameters.
-
-
-
Field Detail
-
NO_CHANGE
public static final Rename NO_CHANGE
A
Renamewhich does not alter the given file name.For example, given
picture.jpg, result ispicture.jpg.Note: The
apply(String, ThumbnailParameter)method does not use theparamparameter. A value ofnullforparamis 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 isthumbnail.picture.jpg.Note: The
apply(String, ThumbnailParameter)method does not use theparamparameter. A value ofnullforparamis permitted.
-
PREFIX_HYPTHEN_THUMBNAIL
@Deprecated public static final Rename PREFIX_HYPTHEN_THUMBNAIL
Deprecated.Please use the correctly spelledPREFIX_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 isthumbnail-picture.jpg.Note: The
apply(String, ThumbnailParameter)method does not use theparamparameter. A value ofnullforparamis 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 isthumbnail-picture.jpg.Note: The
apply(String, ThumbnailParameter)method does not use theparamparameter. A value ofnullforparamis permitted.
-
SUFFIX_DOT_THUMBNAIL
public static final Rename SUFFIX_DOT_THUMBNAIL
Appends
.thumbnailto the file name prior to the extension of the file.For example, given
picture.jpg, result ispicture.thumbnail.jpg.Note: The
apply(String, ThumbnailParameter)method does not use theparamparameter. A value ofnullforparamis permitted.
-
SUFFIX_HYPTHEN_THUMBNAIL
@Deprecated public static final Rename SUFFIX_HYPTHEN_THUMBNAIL
Deprecated.Please use the correctly spelledSUFFIX_HYPHEN_THUMBNAIL. This constant will be removed in Thumbnailator 0.5.0.Appends
-thumbnailto the file name prior to the extension of the file.For example, given
picture.jpg, result ispicture-thumbnail.jpg.Note: The
apply(String, ThumbnailParameter)method does not use theparamparameter. A value ofnullforparamis permitted.
-
SUFFIX_HYPHEN_THUMBNAIL
public static final Rename SUFFIX_HYPHEN_THUMBNAIL
Appends
-thumbnailto the file name prior to the extension of the file.For example, given
picture.jpg, result ispicture-thumbnail.jpg.Note: The
apply(String, ThumbnailParameter)method does not use theparamparameter. A value ofnullforparamis permitted.
-
-
Constructor Detail
-
Rename
protected Rename()
The default constructor is intended only to be called implicitly by the classes implementing the functionality of theRenameclass.
-
-
Method Detail
-
apply
public abstract java.lang.String apply(java.lang.String name, ThumbnailParameter param)Applies the function performed by thisRenameon 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.
-
-