it.geosolutions.tools.commons.file
Class Path

java.lang.Object
  extended by it.geosolutions.tools.commons.file.Path

public class Path
extends Object

Author:
Carlo Cancellieri - carlo.cancellieri@geo-solutions.it

Constructor Summary
Path()
           
 
Method Summary
static File createDirectory(String location, File directory)
           
static File createFile(String location, File directory)
           
static File createTodayDirectory(File destDir, String inputFileName)
          Create a subDirectory having the actual date as name, within a specified destination directory.
static File createTodayDirectory(File destDir, String inputFileName, boolean withTime)
          Create a subDirectory having the actual date as name, within a specified destination directory.
static File findLocation(File location, File directory)
          findLocation(String, String)
static File findLocation(String location, File directory)
          findLocation(String, String)
static String findLocation(String location, String directory)
           
static File rebaseFile(File srcMountPoint, File destMountPoint, File file)
          Rebase the file name in input which must be into the srcMountPoint to destMountPoint:

/src/mount/point/subDir/file.txt
|-srcMountPoint-|---fileName---|
|------------file--------------|

/dest/mount/point/subDir/file.txt
|-destMountPoint-|---fileName---|
|------------return-------------|
static File toRelativeFile(File srcMountPoint, File file)
          Relativize the file name in input which must be into the srcMountPoint:

/src/mount/point/subDir/file.txt
|-srcMountPoint-|---fileName---|
|------------file--------------|

subDir/file.txt
|---fileName---|
|---return-----|
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Path

public Path()
Method Detail

findLocation

public static File findLocation(String location,
                                File directory)
findLocation(String, String)


findLocation

public static File findLocation(File location,
                                File directory)
findLocation(String, String)


findLocation

public static String findLocation(String location,
                                  String directory)
                           throws IllegalArgumentException
Parameters:
location -
directory -
Returns:
the absolute path
Throws:
IllegalArgumentException - if arguments are null

createFile

public static File createFile(String location,
                              File directory)
                       throws IOException
Throws:
IOException

createDirectory

public static File createDirectory(String location,
                                   File directory)
                            throws IOException
Throws:
IOException

rebaseFile

public static File rebaseFile(File srcMountPoint,
                              File destMountPoint,
                              File file)
                       throws IOException,
                              IllegalArgumentException
Rebase the file name in input which must be into the srcMountPoint to destMountPoint:

/src/mount/point/subDir/file.txt
|-srcMountPoint-|---fileName---|
|------------file--------------|

/dest/mount/point/subDir/file.txt
|-destMountPoint-|---fileName---|
|------------return-------------|

Parameters:
sourceMountPoint -
destMountPoint -
file -
Throws:
IOException
IllegalArgumentException

toRelativeFile

public static File toRelativeFile(File srcMountPoint,
                                  File file)
                           throws IOException,
                                  IllegalArgumentException
Relativize the file name in input which must be into the srcMountPoint:

/src/mount/point/subDir/file.txt
|-srcMountPoint-|---fileName---|
|------------file--------------|

subDir/file.txt
|---fileName---|
|---return-----|

Parameters:
sourceMountPoint -
file -
Throws:
IOException
IllegalArgumentException - if arguments are null or not absolute

createTodayDirectory

public static final File createTodayDirectory(File destDir,
                                              String inputFileName,
                                              boolean withTime)
Create a subDirectory having the actual date as name, within a specified destination directory.

Parameters:
destDir - the destination directory where to build the "today" directory.
inputFileName -
Returns:
the created directory.

createTodayDirectory

public static final File createTodayDirectory(File destDir,
                                              String inputFileName)
Create a subDirectory having the actual date as name, within a specified destination directory.

Parameters:
destDir - the destination directory where to build the "today" directory.
inputFileName -
Returns:
the created directory.


Copyright © 2011-2012 GeoSolutions. All Rights Reserved.