Package org.jitsi.impl.fileaccess
Class FileAccessServiceImpl
- java.lang.Object
-
- org.jitsi.impl.fileaccess.FileAccessServiceImpl
-
- All Implemented Interfaces:
FileAccessService
public class FileAccessServiceImpl extends Object implements FileAccessService
Default FileAccessService implementation.- Author:
- Alexander Pelov, Lyubomir Marinov
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classFileAccessServiceImpl.GUID
-
Field Summary
Fields Modifier and Type Field Description static StringTEMP_FILE_PREFIXThe file prefix for all temp files.static StringTEMP_FILE_SUFFIXThe file suffix for all temp files.
-
Constructor Summary
Constructors Constructor Description FileAccessServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description FailSafeTransactioncreateFailSafeTransaction(File file)Creates a failsafe transaction which can be used to safely store informations into a file.FilegetDefaultDownloadDirectory()Returns the default download directory.FilegetPrivatePersistentDirectory(String dirName)Deprecated.FilegetPrivatePersistentDirectory(String dirName, FileCategory category)This method creates a directory specific to the current user.FilegetPrivatePersistentFile(String fileName)Deprecated.FilegetPrivatePersistentFile(String fileName, FileCategory category)This method returns a file specific to the current user.FilegetTemporaryDirectory()Returns the temporary directory.FilegetTemporaryFile()This method returns a created temporary file.
-
-
-
Field Detail
-
TEMP_FILE_PREFIX
public static final String TEMP_FILE_PREFIX
The file prefix for all temp files.- See Also:
- Constant Field Values
-
TEMP_FILE_SUFFIX
public static final String TEMP_FILE_SUFFIX
The file suffix for all temp files.- See Also:
- Constant Field Values
-
-
Method Detail
-
getTemporaryFile
public File getTemporaryFile() throws IOException
This method returns a created temporary file. After you close this file it is not guaranteed that you will be able to open it again nor that it will contain any information. Note: DO NOT store unencrypted sensitive information in this file- Specified by:
getTemporaryFilein interfaceFileAccessService- Returns:
- The created temporary file
- Throws:
IOException- If the file cannot be created
-
getTemporaryDirectory
public File getTemporaryDirectory() throws IOException
Returns the temporary directory.- Specified by:
getTemporaryDirectoryin interfaceFileAccessService- Returns:
- the created temporary directory
- Throws:
IOException- if the temporary directory cannot not be created
-
getPrivatePersistentFile
@Deprecated public File getPrivatePersistentFile(String fileName) throws Exception
Deprecated.Please usegetPrivatePersistentFile(String, FileCategory).- Specified by:
getPrivatePersistentFilein interfaceFileAccessService- Throws:
Exception
-
getPrivatePersistentFile
public File getPrivatePersistentFile(String fileName, FileCategory category) throws Exception
This method returns a file specific to the current user. It may not exist, but it is guaranteed that you will have the sufficient rights to create it. This file should not be considered secure because the implementor may return a file accessible to everyone. Generally it will reside in current user's homedir, but it may as well reside in a shared directory. Note: DO NOT store unencrypted sensitive information in this file- Specified by:
getPrivatePersistentFilein interfaceFileAccessService- Parameters:
fileName- The name of the private file you wish to accesscategory- The classification of the file.- Returns:
- The file
- Throws:
Exception- if we faile to create the file.
-
getPrivatePersistentDirectory
@Deprecated public File getPrivatePersistentDirectory(String dirName) throws Exception
Deprecated.- Specified by:
getPrivatePersistentDirectoryin interfaceFileAccessService- Throws:
Exception
-
getPrivatePersistentDirectory
public File getPrivatePersistentDirectory(String dirName, FileCategory category) throws Exception
This method creates a directory specific to the current user. This directory should not be considered secure because the implementor may return a directory accessible to everyone. Generally it will reside in current user's homedir, but it may as well reside in a shared directory. It is guaranteed that you will be able to create files in it. Note: DO NOT store unencrypted sensitive information in this file- Specified by:
getPrivatePersistentDirectoryin interfaceFileAccessService- Parameters:
dirName- The name of the private directory you wish to access.category- The classification of the directory.- Returns:
- The created directory.
- Throws:
Exception- Thrown if there is no suitable location for the persistent directory.
-
getDefaultDownloadDirectory
public File getDefaultDownloadDirectory() throws IOException
Returns the default download directory.- Specified by:
getDefaultDownloadDirectoryin interfaceFileAccessService- Returns:
- the default download directory
- Throws:
IOException- if it I/O error occurred
-
createFailSafeTransaction
public FailSafeTransaction createFailSafeTransaction(File file)
Creates a failsafe transaction which can be used to safely store informations into a file.- Specified by:
createFailSafeTransactionin interfaceFileAccessService- Parameters:
file- The file concerned by the transaction, null if file is null.- Returns:
- A new failsafe transaction related to the given file.
-
-