Revision 166 org.gvsig.educa.thematicmap/trunk/org.gvsig.educa.thematicmap/org.gvsig.educa.thematicmap.lib/org.gvsig.educa.thematicmap.lib.impl/src/main/java/org/gvsig/educa/thematicmap/impl/util/FileUtils.java

View differences:

FileUtils.java
41 41
 * <p>
42 42
 * File utilities. Extends the provides by <i>apache-common-IO</i>
43 43
 * </p>
44
 *
44
 * 
45 45
 * @author gvSIG Team
46 46
 * @version $Id$
47
 *
47
 * 
48 48
 */
49 49
public abstract class FileUtils extends org.apache.commons.io.FileUtils {
50 50

  
51 51
    private static final Logger LOG = LoggerFactory.getLogger(FileUtils.class);
52 52

  
53
    public static final boolean UNIXLIKE_FILESYSTEM = File.separatorChar == '/';
54

  
53 55
    /**
54 56
     * <p>
55 57
     * Unzip a file into a folder
56 58
     * </p>
57
     *
59
     * 
58 60
     * @param zipFile
59 61
     * @param outputFloder
60 62
     *            must exists. WARNING: <b>Contents will be removed before
......
151 153

  
152 154
    /**
153 155
     * Extract a zipEntry into a file
154
     *
156
     * 
155 157
     * @param zipFile
156 158
     * @param entry
157 159
     * @param target
......
179 181
     * <p>
180 182
     * Files will be use relative path to <code>rootFolder</code>
181 183
     * </p>
182
     *
184
     * 
183 185
     * @param rootFolder
184 186
     *            rootFolder (must be an existing folder)
185 187
     * @param targetFile
......
216 218
    /**
217 219
     * Informs if <code>folder</code> is a writable folder( exists & isDir &
218 220
     * canWrite)
219
     *
221
     * 
220 222
     * @param folder
221 223
     * @return
222 224
     */
......
227 229
    /**
228 230
     * Informs if <code>folder</code> is a readable folder( exists & isDir &
229 231
     * canRead)
230
     *
232
     * 
231 233
     * @param folder
232 234
     * @return
233 235
     */
......
238 240
    /**
239 241
     * Informs if <code>file</code> is a readable file ( exists & isFile &
240 242
     * canRead)
241
     *
243
     * 
242 244
     * @param folder
243 245
     * @return
244 246
     */
......
255 257
     * The pattern is: <code>baseFolder/baseName.0000</code> where
256 258
     * <code>000</code> it's a counter.
257 259
     * </p>
258
     *
260
     * 
259 261
     * @param baseFolder
260 262
     *            existing and writable folder
261 263
     * @param baseName
......
306 308
     * The pattern is: <code>baseFolder/baseName.0000</code> where
307 309
     * <code>000</code> it's a counter.
308 310
     * </p>
309
     *
311
     * 
310 312
     * @param baseFolder
311 313
     *            existing and writable folder
312 314
     * @param baseName
......
361 363
     * <p>
362 364
     * This <b>no create</b> the file into the file system.
363 365
     * </p>
364
     *
366
     * 
365 367
     * @param baseFolder
366 368
     *            existing and writable folder
367 369
     * @param name
......
412 414
     * Return <code>path</code> as relative from <code>basePath</code> only if
413 415
     * <code>basePath</code> is an ancestor of <code>path</code>:
414 416
     * </p>
415
     *
417
     * 
416 418
     * @param path
417 419
     * @param basePath
418 420
     * @return
......
432 434
     * This class generates a Zip file with the context of a folder. All entries
433 435
     * in generated zip will be relatives to source folder.
434 436
     * </p>
435
     *
437
     * 
436 438
     * @author gvSIG Team
437 439
     * @version $Id$
438
     *
440
     * 
439 441
     */
440 442
    private static class RelativePathFolderZipper extends DirectoryWalker {
441 443

  
......
446 448

  
447 449
        /**
448 450
         * Prepares compression process
449
         *
451
         * 
450 452
         * @param rootFolder
451 453
         *            folder to compress
452 454
         * @param targetFile
......
463 465

  
464 466
        /**
465 467
         * Execute compression process
466
         *
468
         * 
467 469
         * @throws IOException
468 470
         */
469 471
        public synchronized void zip() throws IOException {
......
486 488
            String relativePath =
487 489
                FilenameUtils.getRelativeTo(file.getAbsolutePath(),
488 490
                    rootFolderPath);
491
            if (!UNIXLIKE_FILESYSTEM) {
492
                // Avoid problems about unzip in Linux when files was generated
493
                // on a windows
494
                relativePath = FilenameUtils.separatorsToUnix(relativePath);
495
            }
489 496

  
490 497
            InputStream in = null;
491 498
            try {

Also available in: Unified diff