All Downloads are FREE. Search and download functionalities are using the official Maven repository.

hu.meza.tools.config.Loaders.FileConfiguration Maven / Gradle / Ivy

There is a newer version: 1.1.0
Show newest version
package hu.meza.tools.config.Loaders;

import hu.meza.tools.config.Configuration;

import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Properties;

public class FileConfiguration implements Configuration {

	private final Properties properties = new Properties();
	private File file;

	public FileConfiguration(File file) {
		this.file = file;
	}

	@Override
	public boolean load() {
		try {
			InputStream is = new FileInputStream(file);
			properties.load(is);
			return true;
		} catch (Exception e) {
			return false;
		}
	}


	@Override
	public Properties properties() {
		return properties;
	}

	@Override
	public String source() {
		return file.getAbsolutePath();
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy