Class FileManagerServiceImpl
- java.lang.Object
-
- co.mastermindcms.modules.filestorage.services.FileManagerServiceImpl
-
- All Implemented Interfaces:
FileManagerService
@Service public class FileManagerServiceImpl extends java.lang.Object implements FileManagerService
-
-
Constructor Summary
Constructors Constructor Description FileManagerServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
copy(java.nio.file.Path sourcePath, java.nio.file.Path destinationPath)
This method copies a file.void
createDirectory(java.nio.file.Path path)
This method creates a object.void
delete(java.nio.file.Path path)
This method deletes a file.byte[]
downloadFile(java.nio.file.Path path)
This method downloads a file.void
extractZipFile(java.nio.file.Path zipFile, java.nio.file.Path destination)
This method extracts a zip file.java.util.List<java.io.File>
findByPath(java.nio.file.Path path)
This method returns a files list.java.util.List<java.io.File>
findByPath(java.nio.file.Path path, java.io.FileFilter filter)
This method returns a files list.java.util.List<java.io.File>
findFiles(java.nio.file.Path path)
This method returns a files list.java.util.List<java.io.File>
findFiles(java.nio.file.Path path, java.lang.String fileExtension)
This method returns a files list.java.util.List<java.io.File>
findRootFolders(java.nio.file.Path rootPath)
This method returns a files list.void
move(java.nio.file.Path source, java.nio.file.Path destination)
This method moves a file.void
rename(java.nio.file.Path path, java.lang.String newName)
This method updates a file name.void
saveContentToFile(java.lang.String name, java.lang.String path, java.lang.String content)
This method saves content in file.void
uploadFile(java.nio.file.Path path, java.io.InputStream fis)
This method uploads a file.
-
-
-
Method Detail
-
createDirectory
public void createDirectory(java.nio.file.Path path)
Description copied from interface:FileManagerService
This method creates a object.- Specified by:
createDirectory
in interfaceFileManagerService
- Parameters:
path
- java object, which will be created
-
findByPath
public java.util.List<java.io.File> findByPath(java.nio.file.Path path)
Description copied from interface:FileManagerService
This method returns a files list.- Specified by:
findByPath
in interfaceFileManagerService
- Parameters:
path
- to java object, with which the file will be found- Returns:
- files as list
-
findByPath
public java.util.List<java.io.File> findByPath(java.nio.file.Path path, java.io.FileFilter filter)
Description copied from interface:FileManagerService
This method returns a files list.- Specified by:
findByPath
in interfaceFileManagerService
- Parameters:
path
- to java object, with which the file will be foundfilter
- file filter object- Returns:
- files as list
-
findFiles
public java.util.List<java.io.File> findFiles(java.nio.file.Path path)
Description copied from interface:FileManagerService
This method returns a files list.- Specified by:
findFiles
in interfaceFileManagerService
- Parameters:
path
- to java object, with which the file will be found- Returns:
- files as list
-
findFiles
public java.util.List<java.io.File> findFiles(java.nio.file.Path path, java.lang.String fileExtension)
Description copied from interface:FileManagerService
This method returns a files list.- Specified by:
findFiles
in interfaceFileManagerService
- Parameters:
path
- to java object, with which the file will be foundfileExtension
- extension to filter files- Returns:
- files as list
-
findRootFolders
public java.util.List<java.io.File> findRootFolders(java.nio.file.Path rootPath)
Description copied from interface:FileManagerService
This method returns a files list.- Specified by:
findRootFolders
in interfaceFileManagerService
- Parameters:
rootPath
- to files, with which the file will be found- Returns:
- files as list
-
uploadFile
public void uploadFile(java.nio.file.Path path, java.io.InputStream fis)
Description copied from interface:FileManagerService
This method uploads a file.- Specified by:
uploadFile
in interfaceFileManagerService
- Parameters:
path
- path to file, with which the file will be foundfis
- is a stream, with which the file will be uploaded
-
downloadFile
public byte[] downloadFile(java.nio.file.Path path)
Description copied from interface:FileManagerService
This method downloads a file.- Specified by:
downloadFile
in interfaceFileManagerService
- Parameters:
path
- path to file, with which the file will be found- Returns:
- data as byte array
-
move
public void move(java.nio.file.Path source, java.nio.file.Path destination)
Description copied from interface:FileManagerService
This method moves a file.- Specified by:
move
in interfaceFileManagerService
- Parameters:
source
- path to file, with which the file will be founddestination
- path to file, with which the file will be found
-
copy
public void copy(java.nio.file.Path sourcePath, java.nio.file.Path destinationPath)
Description copied from interface:FileManagerService
This method copies a file.- Specified by:
copy
in interfaceFileManagerService
- Parameters:
sourcePath
- path to file, with which the file will be founddestinationPath
- path to file, with which the file will be found
-
rename
public void rename(java.nio.file.Path path, java.lang.String newName)
Description copied from interface:FileManagerService
This method updates a file name.- Specified by:
rename
in interfaceFileManagerService
- Parameters:
path
- path to file, with which the file will be foundnewName
- name value, which will be set file
-
delete
public void delete(java.nio.file.Path path)
Description copied from interface:FileManagerService
This method deletes a file.- Specified by:
delete
in interfaceFileManagerService
- Parameters:
path
- path to file, with which the file will be found
-
extractZipFile
public void extractZipFile(java.nio.file.Path zipFile, java.nio.file.Path destination)
Description copied from interface:FileManagerService
This method extracts a zip file.- Specified by:
extractZipFile
in interfaceFileManagerService
- Parameters:
zipFile
- path of file, with which the file will be uploadeddestination
- path to file, with which the file will be found
-
saveContentToFile
public void saveContentToFile(java.lang.String name, java.lang.String path, java.lang.String content)
Description copied from interface:FileManagerService
This method saves content in file.- Specified by:
saveContentToFile
in interfaceFileManagerService
- Parameters:
name
- is a value, with which the file will be foundpath
- path to file, with which the file will be foundcontent
- content, which will be saved in file
-
-