
com.cloudconvert.client.setttings.PropertyFileSettingsProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cloudconvert-java Show documentation
Show all versions of cloudconvert-java Show documentation
CloudConvert is an online file converter API - more than 200 different audio, video, document, ebook, archive, image, spreadsheet and presentation formats supported.
package com.cloudconvert.client.setttings;
import org.jetbrains.annotations.Nullable;
import java.io.IOException;
import java.io.InputStream;
import java.util.Optional;
import java.util.function.Function;
public class PropertyFileSettingsProvider extends AbstractSettingsProvider {
private static final String DEFAULT_PROPERTIES_PATH = "application.properties";
private static final Function PROPERTIES_FILE_PATH_TO_INPUT_STREAM = (propertiesFilePath) -> {
final String notNullPropertiesFilePath = Optional.ofNullable(propertiesFilePath).orElse(DEFAULT_PROPERTIES_PATH);
return Optional.ofNullable(PropertyFileSettingsProvider.class.getClassLoader().getResourceAsStream(notNullPropertiesFilePath))
.orElseThrow(() -> new IllegalArgumentException("Could not read properties file " + propertiesFilePath + ", make sure it exists ..."));
};
public PropertyFileSettingsProvider() throws IOException {
this(null);
}
public PropertyFileSettingsProvider(
@Nullable final String propertiesFilePath
) throws IOException {
super(PROPERTIES_FILE_PATH_TO_INPUT_STREAM.apply(propertiesFilePath));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy