Package org.jbehave.core.io
Class CodeLocations
java.lang.Object
org.jbehave.core.io.CodeLocations
Collection of utility methods to create code location URLs
-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic URL
codeLocationFromClass
(Class<?> codeLocationClass) Creates a code location URL from a classstatic URL
codeLocationFromPath
(String filePath) Creates a code location URL from a file pathstatic URL
Creates a code location URL from a URLstatic String
getPathFromURL
(URL url) Get absolute path from URL objects starting with file: This method takes care of decoding %-encoded chars, e.g.
-
Constructor Details
-
CodeLocations
public CodeLocations()
-
-
Method Details
-
codeLocationFromClass
Creates a code location URL from a class- Parameters:
codeLocationClass
- the class- Returns:
- A URL created from Class
- Throws:
CodeLocations.InvalidCodeLocation
- if URL creation fails
-
codeLocationFromPath
Creates a code location URL from a file path- Parameters:
filePath
- the file path- Returns:
- A URL created from File
- Throws:
CodeLocations.InvalidCodeLocation
- if URL creation fails
-
codeLocationFromURL
Creates a code location URL from a URL- Parameters:
url
- the URL external form- Returns:
- A URL created from URL
- Throws:
CodeLocations.InvalidCodeLocation
- if URL creation fails
-
getPathFromURL
Get absolute path from URL objects starting with file: This method takes care of decoding %-encoded chars, e.g. %20 -> space etc Since we do not use a File object, the system specific path encoding is not used (e.g. C:\ on Windows). This is necessary to facilitate the removal of a class file with path in codeLocationFromClass- Parameters:
url
- the file-URL- Returns:
- String absolute decoded path
- Throws:
CodeLocations.InvalidCodeLocation
- if URL contains format errors
-