public interface PortableViewFileServices
Modifier and Type | Method and Description |
---|---|
java.io.File |
getNewFileName(java.io.File baseFolder,
java.lang.String name)
Create
File instance for a new file on a baseFolder
starts with baseName . |
java.io.File |
getNewWritableFolder(java.io.File baseFolder,
java.lang.String baseName)
Create a new folder on a
baseFolder starts with
baseName which is new and writable. |
java.io.File |
getRelativeTo(java.io.File path,
java.io.File basePath)
Return
path as relative from basePath only if
basePath is an ancestor of path :
|
java.io.File |
getWritableFolder(java.io.File baseFolder,
java.lang.String baseName)
Look for a folder on a
baseFolder starts with
baseName which is writable. |
boolean |
isReadableFile(java.io.File file)
Informs if
file is a readable file ( exists & isFile &
canRead) |
boolean |
isReadableFolder(java.io.File folder)
Informs if
folder is a readable folder( exists & isDir &
canRead) |
boolean |
isWritableFolder(java.io.File folder)
Informs if
folder is a writable folder( exists & isDir &
canWrite) |
MapContext |
loadMapContext(java.io.File mapContext,
java.io.File relativaPathFolder)
Load a mapContext from a file adjusting file paths which are supposed
relatives to a folder
|
void |
unzipFile(java.io.File zipFile,
java.io.File outputFloder)
Unzip a file into a folder
|
void |
zipFolder(java.io.File rootFolder,
java.io.File targetFile)
Create a zip file which will contains all contents of a folder
Files will be use relative path to
rootFolder
|
void unzipFile(java.io.File zipFile, java.io.File outputFloder) throws java.util.zip.ZipException, java.io.IOException
Unzip a file into a folder
zipFile
- outputFloder
- must exists. WARNING: Contents will be removed before
unzipjava.io.IOException
java.util.zip.ZipException
java.lang.IllegalArgumentException
- if zipFile is not a file or outputFloder doesn't exists or is
read-onlyvoid zipFolder(java.io.File rootFolder, java.io.File targetFile) throws java.io.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)java.io.IOException
java.lang.IllegalArgumentException
- if there are any problem in parametersboolean isWritableFolder(java.io.File folder)
folder
is a writable folder( exists & isDir &
canWrite)folder
- boolean isReadableFolder(java.io.File folder)
folder
is a readable folder( exists & isDir &
canRead)folder
- boolean isReadableFile(java.io.File file)
file
is a readable file ( exists & isFile &
canRead)file
- java.io.File getWritableFolder(java.io.File baseFolder, java.lang.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 folderjava.lang.IllegalArgumentException
- if base folder is not a writable folderjava.lang.IllegalStateException
- if can't found a suitable folderjava.io.File getNewWritableFolder(java.io.File baseFolder, java.lang.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 folderjava.lang.IllegalArgumentException
- if base folder is not a writable folderjava.lang.IllegalStateException
- if can't found a suitable folderjava.io.File getNewFileName(java.io.File baseFolder, java.lang.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 filejava.lang.IllegalArgumentException
- if base folder is not a writable folderjava.lang.IllegalStateException
- if can't found a suitable folderjava.io.File getRelativeTo(java.io.File path, java.io.File basePath)
Return path
as relative from basePath
only if
basePath
is an ancestor of path
:
path
- basePath
- FilenameUtils#getRelativeTo(String, String)
MapContext loadMapContext(java.io.File mapContext, java.io.File relativaPathFolder) throws java.io.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 mapContextjava.io.IOException
PersistenceException