Package lumis.portal.file
Class FileUtil
- java.lang.Object
-
- lumis.portal.file.FileUtil
-
public class FileUtil extends Object
Utility methods for file manipulation.- Since:
- 6.1.0
- Version:
- $Revision: 24028 $ $Date: 2020-08-13 14:17:03 -0300 (Thu, 13 Aug 2020) $
-
-
Constructor Summary
Constructors Constructor Description FileUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static String
calculateWWWFileRelativePath(String path)
Calculates the physical path to the www folder according to aFileConfig path
.static void
deletePortalFile(IFile portalFile)
Deletes portal file and all empty ancestor folders.static void
deletePortalFile(PortalFile portalFile)
Deprecated.since 8.0.0 replaced bydeletePortalFile(IFile)
static String
getContentType(File file)
Deprecated.since 8.0.0 replaced bygetContentType(IFile)
.static String
getContentType(InputStream is, String fileName)
Returns the content type based on the given file name and input stream.static String
getContentType(IFile file)
Gets content type based on the given file.static IResource
getFileResource()
Returns the file resource.static IWebsite
getWebsiteByFile(FileConfig fileConfig, ITransaction transaction)
Returns the website of the given file (the website that contains the file's service instance).
-
-
-
Method Detail
-
getContentType
@Deprecated public static String getContentType(File file) throws IOException
Deprecated.since 8.0.0 replaced bygetContentType(IFile)
.Gets content type based on the given file.- Parameters:
file
- the file.- Returns:
- content type.
- Throws:
IOException
- if an IO error occured.- Since:
- 6.1.0
-
getContentType
public static String getContentType(InputStream is, String fileName) throws IOException
Returns the content type based on the given file name and input stream.- Parameters:
is
- the input stream.fileName
- the file name.- Returns:
- the content type based on the given file name and input stream.
- Throws:
IOException
- Since:
- 8.1.0
-
getContentType
public static String getContentType(IFile file) throws IOException
Gets content type based on the given file.- Parameters:
file
- the file.- Returns:
- the content type based on the given file.
- Throws:
IOException
- Since:
- 8.0.0
-
calculateWWWFileRelativePath
public static String calculateWWWFileRelativePath(String path)
Calculates the physical path to the www folder according to aFileConfig path
.- Parameters:
path
- the path stored in theFileConfig
.- Returns:
- adjusted relative path, relative to a web root path.
- Since:
- 6.1.0
-
deletePortalFile
@Deprecated public static void deletePortalFile(PortalFile portalFile)
Deprecated.since 8.0.0 replaced bydeletePortalFile(IFile)
Deletes portal file and all empty ancestor folders.- Parameters:
portalFile
- thefile
to be deleted.- Since:
- 6.1.0
-
deletePortalFile
public static void deletePortalFile(IFile portalFile) throws FileNotFoundException, FileCouldNotBeDeletedException, IOException
Deletes portal file and all empty ancestor folders.- Parameters:
portalFile
- thefile
to be deleted.- Throws:
FileNotFoundException
FileCouldNotBeDeletedException
IOException
- Since:
- 8.0.0
-
getWebsiteByFile
public static IWebsite getWebsiteByFile(FileConfig fileConfig, ITransaction transaction) throws ManagerException, PortalException
Returns the website of the given file (the website that contains the file's service instance).- Parameters:
fileConfig
- the file.transaction
- the transaction.- Returns:
- the website of the given file (the website that contains the file's service instance).
- Throws:
ManagerException
PortalException
- Since:
- 6.2.0
-
getFileResource
public static IResource getFileResource()
Returns the file resource.- Returns:
- the file resource
- Since:
- 7.0.0
-
-