Package org.arakhne.afc.inputoutput.path
Interface PathBuilder
-
- All Known Implementing Classes:
SimplePathBuilder
public interface PathBuilder
Interface that permits to build absolute paths from relative paths and relative paths from absolute paths.- 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
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description File
getCurrentDirectoryFile()
Replies the default/current directory used to make absolute the reltive paths.default String
getCurrentDirectoryString()
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.default URL
makeAbsolute(File filename)
Make the given filename absolute.default URL
makeAbsolute(String filename)
Make the given filename absolute.default URL
makeAbsolute(URL filename)
Make the given filename absolute.default File
makeRelative(File filename)
Make the given filename relative.default File
makeRelative(String filename)
Make the given filename relative.default File
makeRelative(URL filename)
Make the given filename relative.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.default URL
toShorterURL(URL url)
Try to make the given URL shorter in its form.
-
-
-
Method Detail
-
setCurrentDirectory
void setCurrentDirectory(String currentDirectory)
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
.- Parameters:
currentDirectory
- is the default/current directory used to make absolute the reltive paths.
-
setCurrentDirectory
void setCurrentDirectory(File currentDirectory)
Set the default/current directory used to make absolute the reltive paths.- Parameters:
currentDirectory
- is the default/current directory used to make absolute the reltive paths.
-
setCurrentDirectory
void setCurrentDirectory(URL currentDirectory)
Set the default/current directory used to make absolute the reltive paths.- Parameters:
currentDirectory
- is the default/current directory used to make absolute the reltive paths.
-
getCurrentDirectoryString
@Pure default String getCurrentDirectoryString()
Replies the default/current directory used to make absolute the reltive paths.This function replies the external form of the value replied by
getCurrentDirectoryURL()
- Returns:
- the default/current directory used to make absolute the reltive paths.
- See Also:
getCurrentDirectoryFile()
,getCurrentDirectoryURL()
-
getCurrentDirectoryFile
@Pure File getCurrentDirectoryFile()
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.- Returns:
- the default/current directory used to make absolute the reltive paths.
- See Also:
getCurrentDirectoryString()
,getCurrentDirectoryURL()
-
getCurrentDirectoryURL
@Pure URL getCurrentDirectoryURL()
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
.- Returns:
- the default/current directory used to make absolute the reltive paths.
- See Also:
getCurrentDirectoryFile()
,getCurrentDirectoryString()
-
makeAbsolute
@Pure default URL makeAbsolute(File filename)
Make the given filename absolute.- Parameters:
filename
- the file.- Returns:
- absolute equivalent name.
-
makeAbsolute
@Pure default URL makeAbsolute(URL filename)
Make the given filename absolute.- Parameters:
filename
- the file.- Returns:
- absolute equivalent name.
-
makeAbsolute
@Pure default URL makeAbsolute(String filename)
Make the given filename absolute.If the given filename is an URL, the external form of the URL is replied.
- Parameters:
filename
- the file.- Returns:
- absolute equivalent name or
null
if it is impossible to obtain an URL.
-
makeRelative
@Pure default File makeRelative(File filename) throws IOException
Make the given filename relative.- Parameters:
filename
- the file.- Returns:
- relative equivalent name.
- Throws:
IOException
- in case of error.
-
makeRelative
@Pure default File makeRelative(URL filename) throws IOException
Make the given filename relative.- Parameters:
filename
- the file.- Returns:
- relative equivalent name.
- Throws:
IOException
- in case of error.
-
makeRelative
@Pure default File makeRelative(String filename) throws IOException
Make the given filename relative.If the given filename is an URL, the external form of the URL is replied.
- Parameters:
filename
- filename.- Returns:
- relative equivalent name or
null
if it is impossible to obtain an File. - Throws:
IOException
- in case of error.
-
-