public final class FileUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static String |
calculateDigest(InputStream is)
Calculates the MD5 digest from the content of the supplied input stream.
|
static void |
cleanDirectory(File directory,
FileFilter filter)
Cleans a directory without deleting it, considering also named exclusions.
|
static String |
getContent(org.springframework.core.io.Resource resource)
Returns the content of the specified
Resource as a string. |
static String |
getExtension(String fileName) |
static String |
getExtensionFromMimeType(String mimeType) |
static String[] |
getFileExtensionIconsMapping() |
static String |
getFileIcon(String fileName)
Return file icon for the given file name, based on the extension
|
static String |
getFileIconFromMimetype(String mimeType)
Return file icon for the given mime type
|
static long |
getLastModified(org.springframework.core.io.Resource resource)
Returns the last modified date of the specified resource.
|
static List<org.artofsolving.jodconverter.document.DocumentFormat> |
getPossibleFormats() |
static String |
humanReadableByteCount(long bytes)
Returns a human-readable representation of the file size (number of bytes).
|
static String |
humanReadableByteCount(long bytes,
boolean withDetails)
Returns a human-readable representation of the file size (number of bytes).
|
static void |
moveDirectoryContentToDirectory(File srcDir,
File destDir,
FileFilter filter)
Moves the content of the directory to the specified one considering the filter.
|
public static String calculateDigest(InputStream is)
is - the resource input streampublic static void cleanDirectory(File directory, FileFilter filter) throws IOException
directory - directory to cleanfilter - the file filter to considerIOException - in case cleaning is unsuccessfulFileUtils.cleanDirectory(File)public static String getContent(org.springframework.core.io.Resource resource) throws IOException
Resource as a string.resource - the resource to be readResource as a stringIOException - in case of an I/O errorpublic static String[] getFileExtensionIconsMapping()
public static String getFileIcon(String fileName)
fileName - the name of the filepublic static String getFileIconFromMimetype(String mimeType)
mimeType - the mime type of the filepublic static long getLastModified(org.springframework.core.io.Resource resource)
throws IOException
resource - resource to check the last modified date onIOException - in case of an I/O errorpublic static List<org.artofsolving.jodconverter.document.DocumentFormat> getPossibleFormats()
public static String humanReadableByteCount(long bytes)
bytes - the file size in bytespublic static String humanReadableByteCount(long bytes, boolean withDetails)
bytes - the file size in byteswithDetails - if true the full display view is used, which also includes the byte countpublic static void moveDirectoryContentToDirectory(File srcDir, File destDir, FileFilter filter) throws IOException
srcDir - the source directory to move content fromdestDir - the target directoryfilter - a filter for inclusionsIOException - in case of an I/O errorsCopyright © 2004–2020 Jahia Solutions Group SA. All rights reserved.