Helper class for resolving assets
| Type | Name and description |
|---|---|
static String |
DIRECTIVE_FILE_SEPARATOR |
static String |
QUOTED_FILE_SEPARATOR |
static Collection<Class<AssetFile>> |
assetSpecs |
| Type | Name and description |
|---|---|
static Collection<Class<AssetFile>> |
assetFileClasses()@return The classes that implement the AssetFile interface |
static Class<AssetFile> |
assetForFileName(String filename)Finds the AssetFile definition for the specified file name based on its extension |
static List<String> |
assetMimeTypeForURI(String uri)The asset content type for the given URI |
static String |
extensionFromURI(String uri)Obtains the extension for the given URI |
static AssetFile |
fileForFullName(String uri)Obtains an AssetFile instance for the given URI |
static AssetFile |
fileForUri(String uri, String contentType = null, String ext = null, AssetFile baseFile = null)Resolve an AssetFile for the given URI |
static String |
fileNameWithoutExtensionFromArtefact(String filename, AssetFile assetFile) |
static AssetFile |
getAssetFileWithExtension(String uri, String ext)@param uri string representation of the asset file. |
static String |
getByteDigest(byte[] fileBytes)Generates an MD5 Byte Digest from a byte array |
static Collection<Class<AssetFile>> |
getPossibleFileSpecs(String contentType)Returns the possible AssetFile classes for the given content type |
static boolean |
isFileMatchingPatterns(String filePath, List<String> patterns)Checks if a file path matches any pattern provided. |
static String |
nameWithoutExtension(String uri)Obtains the name of the file sans the extension |
static String |
normalizePath(String path)Normalizes a path into a standard path, stripping out all path elements that walk the path (i.e. '..' and '.') |
Finds the AssetFile definition for the specified file name based on its extension
filename - String filename representationThe asset content type for the given URI
uri - The URIObtains the extension for the given URI
uri - The URIObtains an AssetFile instance for the given URI
uri - The given URIResolve an AssetFile for the given URI
uri - The URIcontentType - The content typeext - The extensionbaseFile - The base file
uri - string representation of the asset file.ext - the extension of the fileGenerates an MD5 Byte Digest from a byte array
fileBytes - byte[] array of the contents of a fileReturns the possible AssetFile classes for the given content type
contentType - The content typeChecks if a file path matches any pattern provided. These default to glob format but can be changed to use regular expressions by prefixing the pattern string with 'regex:'
filePath - String the fully qualified asset path we are checkingpatterns - a ListObtains the name of the file sans the extension
uri - The URI