We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Maybe constructor that takes a String with "/" and uses Thread.currentThread().getClassLoader() everywhere.
The text was updated successfully, but these errors were encountered:
public static List<String> listResourceDirectoryContents(String relativePath) { try { return IOUtils.readLines(Thread.currentThread().getContextClassLoader().getResourceAsStream(relativePath), StandardCharsets.UTF_8); } catch (IOException e) { throw new RuntimeException(e.getMessage()); } } public static InputStream streamFromClassPath(Path path) { String slashConversion = ""; for (int i = 0; i < path.getNameCount(); i++) { slashConversion += path.getName(i).toString(); if (i < path.getNameCount() - 1) { slashConversion += "/"; } } return Thread.currentThread().getContextClassLoader().getResourceAsStream(slashConversion); } public static File fileFromClassPath(Path path) { String slashConversion = ""; for (int i = 0; i < path.getNameCount(); i++) { slashConversion += path.getName(i).toString(); if (i < path.getNameCount() - 1) { slashConversion += "/"; } } URL resourceUrl = Thread.currentThread().getContextClassLoader().getResource(slashConversion); String resourceUrlPath = resourceUrl.getPath(); if (SystemUtils.IS_OS_WINDOWS) resourceUrlPath = resourceUrlPath.substring(1, resourceUrlPath.length()); return Paths.get(resourceUrlPath).toFile(); }
Sorry, something went wrong.
No branches or pull requests
Maybe constructor that takes a String with "/" and uses Thread.currentThread().getClassLoader() everywhere.
The text was updated successfully, but these errors were encountered: