This commit is contained in:
moandji.ezana 2015-08-15 02:12:44 +02:00
parent d60736e104
commit 4773638a12

View file

@ -2,6 +2,7 @@ package com.moandjiezana.toml;
import java.io.BufferedReader; 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.IOException; import java.io.IOException;
@ -62,14 +63,14 @@ public class Toml {
/** /**
* Populates the current Toml instance with values from file. * Populates the current Toml instance with values from file.
* *
* @param file The File to be read * @param file The File to be read. Expected to be encoded as UTF-8.
* @return this instance * @return this instance
* @throws IllegalStateException If file contains invalid TOML * @throws IllegalStateException If file contains invalid TOML
*/ */
public Toml read(File file) { public Toml read(File file) {
try { try {
return read(new FileReader(file)); return read(new InputStreamReader(new FileInputStream(file), "UTF8"));
} catch (FileNotFoundException e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
} }