Package lumis.portal.file
Class FileUtil
- java.lang.Object
-
- lumis.portal.file.FileUtil
-
public class FileUtil extends java.lang.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 java.lang.String
calculateWWWFileRelativePath(java.lang.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 java.lang.String
getContentType(java.io.File file)
Deprecated.since 8.0.0 replaced bygetContentType(IFile)
.static java.lang.String
getContentType(java.io.InputStream is, java.lang.String fileName)
Returns the content type based on the given file name and input stream.static java.lang.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 java.lang.String getContentType(java.io.File file) throws java.io.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:
java.io.IOException
- if an IO error occured.- Since:
- 6.1.0
-
getContentType
public static java.lang.String getContentType(java.io.InputStream is, java.lang.String fileName) throws java.io.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:
java.io.IOException
- Since:
- 8.1.0
-
getContentType
public static java.lang.String getContentType(IFile file) throws java.io.IOException
Gets content type based on the given file.- Parameters:
file
- the file.- Returns:
- the content type based on the given file.
- Throws:
java.io.IOException
- Since:
- 8.0.0
-
calculateWWWFileRelativePath
public static java.lang.String calculateWWWFileRelativePath(java.lang.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 java.io.FileNotFoundException, FileCouldNotBeDeletedException, java.io.IOException
Deletes portal file and all empty ancestor folders.- Parameters:
portalFile
- thefile
to be deleted.- Throws:
java.io.FileNotFoundException
FileCouldNotBeDeletedException
java.io.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
-
-