Package org.arakhne.afc.inputoutput.path
Class SimplePathBuilder
- java.lang.Object
-
- org.arakhne.afc.inputoutput.path.SimplePathBuilder
-
- All Implemented Interfaces:
PathBuilder
public class SimplePathBuilder extends Object implements PathBuilder
Simple implementation of a tool that permits to convert filenames from absolute to relative and the opposite..- Since:
- 15.0
- Version:
- 17.0 2020-01-04 14:41:40
- Author:
- Stéphane GALLAND
- Maven Group Id:
- org.arakhne.afc.core
- Maven Artifact Id:
- inputoutput
-
-
Constructor Summary
Constructors Constructor Description SimplePathBuilder()
Constructor.SimplePathBuilder(File currentDirectory)
Constructor with current directory.SimplePathBuilder(String currentDirectory)
Constructor with current directory.SimplePathBuilder(URL currentDirectory)
Constructor with current directory.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description File
getCurrentDirectoryFile()
Replies the default/current directory used to make absolute the reltive paths.URL
getCurrentDirectoryURL()
Replies the default/current directory used to make absolute the reltive paths.void
setCurrentDirectory(File currentDirectory)
Set the default/current directory used to make absolute the reltive paths.void
setCurrentDirectory(String currentDirectory)
Set the default/current directory used to make absolute the reltive paths.void
setCurrentDirectory(URL currentDirectory)
Set the default/current directory used to make absolute the reltive paths.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.arakhne.afc.inputoutput.path.PathBuilder
getCurrentDirectoryString, makeAbsolute, makeAbsolute, makeAbsolute, makeRelative, makeRelative, makeRelative, toShorterURL
-
-
-
-
Constructor Detail
-
SimplePathBuilder
public SimplePathBuilder()
Constructor.
-
SimplePathBuilder
public SimplePathBuilder(String currentDirectory)
Constructor with current directory.- Parameters:
currentDirectory
- is the default/current directory used to make absolute the reltive paths.
-
SimplePathBuilder
public SimplePathBuilder(File currentDirectory)
Constructor with current directory.- Parameters:
currentDirectory
- is the default/current directory used to make absolute the reltive paths.
-
SimplePathBuilder
public SimplePathBuilder(URL currentDirectory)
Constructor with current directory.- Parameters:
currentDirectory
- is the default/current directory used to make absolute the reltive paths.
-
-
Method Detail
-
setCurrentDirectory
public void setCurrentDirectory(String currentDirectory)
Description copied from interface:PathBuilder
Set the default/current directory used to make absolute the reltive paths.This function tries to build an
URL
, and if it fails it assumed that the given string is a filename to pass toFile
.- Specified by:
setCurrentDirectory
in interfacePathBuilder
- Parameters:
currentDirectory
- is the default/current directory used to make absolute the reltive paths.
-
setCurrentDirectory
public void setCurrentDirectory(File currentDirectory)
Description copied from interface:PathBuilder
Set the default/current directory used to make absolute the reltive paths.- Specified by:
setCurrentDirectory
in interfacePathBuilder
- Parameters:
currentDirectory
- is the default/current directory used to make absolute the reltive paths.
-
setCurrentDirectory
public void setCurrentDirectory(URL currentDirectory)
Description copied from interface:PathBuilder
Set the default/current directory used to make absolute the reltive paths.- Specified by:
setCurrentDirectory
in interfacePathBuilder
- Parameters:
currentDirectory
- is the default/current directory used to make absolute the reltive paths.
-
getCurrentDirectoryFile
public File getCurrentDirectoryFile()
Description copied from interface:PathBuilder
Replies the default/current directory used to make absolute the reltive paths.If the current directory is a
File
, it is replied. If the current directory is anURL
with "file" protocol, its path is replied. In all other cases the user home directory is replied, or the default directory if the user home is unavailable.- Specified by:
getCurrentDirectoryFile
in interfacePathBuilder
- Returns:
- the default/current directory used to make absolute the reltive paths.
- See Also:
PathBuilder.getCurrentDirectoryString()
,PathBuilder.getCurrentDirectoryURL()
-
getCurrentDirectoryURL
public URL getCurrentDirectoryURL()
Description copied from interface:PathBuilder
Replies the default/current directory used to make absolute the reltive paths.This function replies the URL of the current directory even if the current directory was set with a
File
.- Specified by:
getCurrentDirectoryURL
in interfacePathBuilder
- Returns:
- the default/current directory used to make absolute the reltive paths.
- See Also:
PathBuilder.getCurrentDirectoryFile()
,PathBuilder.getCurrentDirectoryString()
-
-