com.afrigis.services.util.Version Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of core Show documentation
Show all versions of core Show documentation
Core Java library to ease use of AfriGIS Services
package com.afrigis.services.util;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import org.apache.commons.io.IOUtils;
/**
*
* Carefully and safely extracts the library version if available.
*
*
* @author hendrikc
*
*/
public final class Version {
private Version() {
}
/**
*
* Extracts and returns the semantic version of this lib.
*
*
* @return the version of this library
*/
public static String getVersion() {
final String path = "/version.prop";
InputStream stream = null;
final Properties props = new Properties();
try {
stream = Version.class.getResourceAsStream(path);
props.load(stream);
return (String) props.get("version");
} catch (IOException e) {
return "UNKNOWN";
} finally {
IOUtils.closeQuietly(stream);
}
}
}