Package org.arakhne.afc.inputoutput.path
Interface PathBuilder
-
- All Known Implementing Classes:
SimplePathBuilder
public interface PathBuilderInterface 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 FilegetCurrentDirectoryFile()Replies the default/current directory used to make absolute the reltive paths.default StringgetCurrentDirectoryString()Replies the default/current directory used to make absolute the reltive paths.URLgetCurrentDirectoryURL()Replies the default/current directory used to make absolute the reltive paths.default URLmakeAbsolute(File filename)Make the given filename absolute.default URLmakeAbsolute(String filename)Make the given filename absolute.default URLmakeAbsolute(URL filename)Make the given filename absolute.default FilemakeRelative(File filename)Make the given filename relative.default FilemakeRelative(String filename)Make the given filename relative.default FilemakeRelative(URL filename)Make the given filename relative.voidsetCurrentDirectory(File currentDirectory)Set the default/current directory used to make absolute the reltive paths.voidsetCurrentDirectory(String currentDirectory)Set the default/current directory used to make absolute the reltive paths.voidsetCurrentDirectory(URL currentDirectory)Set the default/current directory used to make absolute the reltive paths.default URLtoShorterURL(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 anURLwith "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
nullif 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
nullif it is impossible to obtain an File. - Throws:
IOException- in case of error.
-
-