public class DefaultPortableViewFileServices extends Object implements PortableViewFileServices
Default implementation of PortableViewFileServices
Delegates almost all methods in FilenameUtils
Constructor and Description |
---|
DefaultPortableViewFileServices() |
Modifier and Type | Method and Description |
---|---|
File |
getNewFileName(File baseFolder,
String name) |
File |
getNewWritableFolder(File baseFolder,
String baseName) |
File |
getRelativeTo(File path,
File basePath) |
File |
getWritableFolder(File baseFolder,
String baseName) |
boolean |
isReadableFile(File file) |
boolean |
isReadableFolder(File folder) |
boolean |
isWritableFolder(File folder) |
MapContext |
loadMapContext(File mapContext,
File relativaPathFolder) |
void |
unzipFile(File zipFile,
File outputFloder) |
void |
zipFolder(File rootFolder,
File targetFile) |
public void unzipFile(File zipFile, File outputFloder) throws ZipException, IOException
unzipFile
in interface PortableViewFileServices
outputFloder
- must exists. WARNING: Contents will be removed before
unzipZipException
IOException
public void zipFolder(File rootFolder, File targetFile) throws IOException
zipFolder
in interface PortableViewFileServices
rootFolder
- rootFolder (must be an existing folder)targetFile
- final file (must not exists)IOException
public boolean isWritableFolder(File folder)
isWritableFolder
in interface PortableViewFileServices
public boolean isReadableFolder(File folder)
isReadableFolder
in interface PortableViewFileServices
public boolean isReadableFile(File file)
isReadableFile
in interface PortableViewFileServices
public File getWritableFolder(File baseFolder, String baseName)
getWritableFolder
in interface PortableViewFileServices
baseFolder
- existing and writable folderbaseName
- start of new folderpublic File getNewWritableFolder(File baseFolder, String baseName)
getNewWritableFolder
in interface PortableViewFileServices
baseFolder
- existing and writable folderbaseName
- start of new folderpublic File getNewFileName(File baseFolder, String name)
getNewFileName
in interface PortableViewFileServices
baseFolder
- existing and writable foldername
- start of new filepublic File getRelativeTo(File path, File basePath)
getRelativeTo
in interface PortableViewFileServices
FilenameUtils#getRelativeTo(String, String)
public MapContext loadMapContext(File mapContext, File relativaPathFolder) throws IOException, PersistenceException
loadMapContext
in interface PortableViewFileServices
mapContext
- persistence filerelativaPathFolder
- for files refered in mapContextIOException
PersistenceException