use of com.amazonaws.services.dynamodbv2.model.Stream in project tutorials by eugenp.
the class ProductInfoRepositoryIntegrationTest method loadFromFileInClasspath.
private static Optional<Properties> loadFromFileInClasspath(String fileName) {
InputStream stream = null;
try {
Properties config = new Properties();
Path configLocation = Paths.get(ClassLoader.getSystemResource(fileName).toURI());
stream = Files.newInputStream(configLocation);
config.load(stream);
return Optional.of(config);
} catch (Exception e) {
return Optional.empty();
} finally {
if (stream != null) {
try {
stream.close();
} catch (IOException e) {
}
}
}
}
Aggregations