Fixed encoding issue on windows
This commit is contained in:
parent
fa152be94e
commit
d830284ed2
2 changed files with 16 additions and 12 deletions
|
@ -6,7 +6,7 @@ package semantic.model;
|
||||||
public interface IModelFunctions
|
public interface IModelFunctions
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Creates an instance of the class "Lieu" of your ontology
|
* Creates an instance of the class "Place" of your ontology
|
||||||
* @param name
|
* @param name
|
||||||
* @return the URI of the instance
|
* @return the URI of the instance
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,10 +1,14 @@
|
||||||
package semantic.model;
|
package semantic.model;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.AbstractMap;
|
import java.util.AbstractMap;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -296,17 +300,17 @@ public class SemanticModel implements IConvenienceInterface
|
||||||
void loadFromFile(String path, String base, String lang, boolean supportObjectProperties)
|
void loadFromFile(String path, String base, String lang, boolean supportObjectProperties)
|
||||||
{
|
{
|
||||||
Model tmpModel = ModelFactory.createDefaultModel();
|
Model tmpModel = ModelFactory.createDefaultModel();
|
||||||
FileReader f = null;
|
try (FileInputStream fis = new FileInputStream(path);
|
||||||
try
|
InputStreamReader isr = new InputStreamReader(fis, StandardCharsets.UTF_8);
|
||||||
{
|
BufferedReader reader = new BufferedReader(isr)
|
||||||
f = new FileReader(new File(path));
|
) {
|
||||||
}
|
|
||||||
catch (FileNotFoundException e)
|
tmpModel.read(reader, base, lang);
|
||||||
{
|
this.writeFromModel(tmpModel, supportObjectProperties);
|
||||||
e.printStackTrace();
|
|
||||||
}
|
} catch (IOException e) {
|
||||||
tmpModel.read(f, base, lang);
|
e.printStackTrace();
|
||||||
this.writeFromModel(tmpModel, supportObjectProperties);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue