public interface PortableViewFileServices
Modifier and Type | Method and Description |
---|---|
File |
getNewFileName(File baseFolder,
String name)
|
File |
getNewWritableFolder(File baseFolder,
String baseName)
Create a new folder on a
baseFolder starts with
baseName which is new and writable. |
File |
getRelativeTo(File path,
File basePath)
Return
path as relative from basePath only if
basePath is an ancestor of path :
|
File |
getWritableFolder(File baseFolder,
String baseName)
Look for a folder on a
baseFolder starts with
baseName which is writable. |
boolean |
isReadableFile(File file)
Informs if
file is a readable file ( exists & isFile &
canRead) |
boolean |
isReadableFolder(File folder)
Informs if
folder is a readable folder( exists & isDir &
canRead) |
boolean |
isWritableFolder(File folder)
Informs if
folder is a writable folder( exists & isDir &
canWrite) |
MapContext |
loadMapContext(File mapContext,
File relativaPathFolder)
Load a mapContext from a file adjusting file paths which are supposed
relatives to a folder
|
void |
unzipFile(File zipFile,
File outputFloder)
Unzip a file into a folder
|
void |
zipFolder(File rootFolder,
File targetFile)
Create a zip file which will contains all contents of a folder
Files will be use relative path to
rootFolder
|
void unzipFile(File zipFile, File outputFloder) throws ZipException, IOException
Unzip a file into a folder
zipFile
- outputFloder
- must exists. WARNING: Contents will be removed before
unzipIOException
ZipException
IllegalArgumentException
- if zipFile is not a file or outputFloder doesn't exists or is
read-onlyvoid zipFolder(File rootFolder, File targetFile) throws IOException
Create a zip file which will contains all contents of a folder
Files will be use relative path to rootFolder
rootFolder
- rootFolder (must be an existing folder)targetFile
- final file (must not exists)IOException
IllegalArgumentException
- if there are any problem in parametersboolean isWritableFolder(File folder)
folder
is a writable folder( exists & isDir &
canWrite)folder
- boolean isReadableFolder(File folder)
folder
is a readable folder( exists & isDir &
canRead)folder
- boolean isReadableFile(File file)
file
is a readable file ( exists & isFile &
canRead)file
- File getWritableFolder(File baseFolder, String baseName)
Look for a folder on a baseFolder
starts with
baseName
which is writable.
The pattern is: baseFolder/baseName.0000
where
000
it's a counter.
baseFolder
- existing and writable folderbaseName
- start of new folderIllegalArgumentException
- if base folder is not a writable folderIllegalStateException
- if can't found a suitable folderFile getNewWritableFolder(File baseFolder, String baseName)
Create a new folder on a baseFolder
starts with
baseName
which is new and writable.
The pattern is: baseFolder/baseName.0000
where
000
it's a counter.
baseFolder
- existing and writable folderbaseName
- start of new folderIllegalArgumentException
- if base folder is not a writable folderIllegalStateException
- if can't found a suitable folderFile getNewFileName(File baseFolder, String name)
Create File
instance for a new file on a baseFolder
starts with baseName
.
The pattern is: baseFolder/baseName.0000.ext
where
000
it's a counter.
This no create the file into the file system.
baseFolder
- existing and writable foldername
- start of new fileIllegalArgumentException
- if base folder is not a writable folderIllegalStateException
- if can't found a suitable folderFile getRelativeTo(File path, File basePath)
Return path
as relative from basePath
only if
basePath
is an ancestor of path
:
path
- basePath
- FilenameUtils#getRelativeTo(String, String)
MapContext loadMapContext(File mapContext, File relativaPathFolder) throws IOException, PersistenceException
Load a mapContext from a file adjusting file paths which are supposed relatives to a folder
mapContext
- persistence filerelativaPathFolder
- for files refered in mapContextIOException
PersistenceException