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

com.ontotext.kim.gate.SettingsHashBuilder Maven / Gradle / Ivy

The newest version!
package com.ontotext.kim.gate;

import gate.util.Files;

import java.io.IOException;
import java.net.URL;

import org.apache.commons.io.FileUtils;

import com.ontotext.kim.util.StringTransformations;

public class SettingsHashBuilder {

	public int getHash(URL configFile, String query) {
		query = StringTransformations.stripMultiWS(query);
		try {
			String configString =
        FileUtils.readFileToString(Files.fileFromURL(configFile));
			configString = StringTransformations.stripMultiWS(configString);
			return (query + ";" + configString).hashCode();
		}
		catch (IOException e) {
			return query.hashCode();
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy